Skip to content

Commit

Permalink
Merge pull request #894 from Shadow243/correct-github-actions
Browse files Browse the repository at this point in the history
Resolve the issue with the missing Dotenv class
  • Loading branch information
kroky authored Feb 13, 2024
2 parents 2c635a4 + 22d5dd5 commit eea3c4c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/tests/test.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

phpunit_tests() {
phpunit --configuration tests/phpunit/phpunit.xml --testdox
phpunit --bootstrap vendor/autoload.php --configuration tests/phpunit/phpunit.xml --testdox
}

selenium_tests() {
Expand Down
18 changes: 9 additions & 9 deletions modules/core/output_modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -607,15 +607,6 @@ class Hm_Output_js_data extends Hm_Output_Module {
protected function output() {
$res = '<script type="text/javascript">'.
'var globals = {};'.
'window.hm_current_lang = ' . json_encode($this->lang) . ';' .
'window.hm_translations = ' . json_encode($this->all_trans()) . ';' .
'var hm_trans = function(key, lang = window.hm_current_lang) {' .
' const langTranslations = window.translations && window.translations[lang];' .
' if (langTranslations && langTranslations[key] !== undefined && langTranslations[key] !== false) {' .
' return langTranslations[key];' .
' }' .
' return key;' .
'};' .
'var hm_empty_folder = function() { return "'.$this->trans('So alone').'"; };'.
'var hm_mobile = function() { return '.($this->get('is_mobile') ? '1' : '0').'; };'.
'var hm_debug = function() { return "'.(DEBUG_MODE ? '1' : '0').'"; };'.
Expand All @@ -638,6 +629,15 @@ protected function output() {
else {
$res .= 'var hm_delete_prompt = function() { return true; };';
}
$res .= 'window.hm_current_lang = '.$this->lang.';'.
'window.hm_translations = '.json_encode($this->all_trans()).';'.
'var hm_trans = function(key, lang = window.hm_current_lang) {'.
' const langTranslations = window.translations && window.translations[lang];'.
' if (langTranslations && langTranslations[key] !== undefined && langTranslations[key] !== false) {'.
' return langTranslations[key];'.
' }'.
' return key;'.
'};'.
$res .= '</script>';
return $res;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/phpunit/modules/core/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -877,10 +877,10 @@ public function test_js_data() {
$test = new Output_Test('js_data', 'core');
$test->handler_response = array('disable_delete_prompt' => true);
$res = $test->run();
$this->assertEquals(array('<script type="text/javascript">var globals = {};var hm_empty_folder = function() { return "So alone"; };var hm_mobile = function() { return 0; };var hm_debug = function() { return "0"; };var hm_mailto = function() { return 0; };var hm_page_name = function() { return ""; };var hm_language_direction = function() { return "ltr"; };var hm_list_path = function() { return ""; };var hm_list_parent = function() { return ""; };var hm_msg_uid = function() { return Hm_Utils.get_from_global("msg_uid", ""); };var hm_encrypt_ajax_requests = function() { return ""; };var hm_encrypt_local_storage = function() { return ""; };var hm_web_root_path = function() { return ""; };var hm_flag_image_src = function() { return "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228%22%20height%3D%228%22%20viewBox%3D%220%200%208%208%22%3E%0A%20%20%3Cpath%20d%3D%22M0%200v8h1v-8h-1zm2%200v4h2v1h4l-2-1.969%202-2.031h-3v-1h-3z%22%20%2F%3E%0A%3C%2Fsvg%3E"; };var hm_check_dirty_flag = function() { return 0; };var hm_data_sources = function() { return []; };var hm_delete_prompt = function() { return true; };</script>'), $res->output_response);
$this->assertStringStartsWith('<script type="text/javascript">var globals = {};var hm_empty_folder = function() { return "So alone"; };var hm_mobile = function() { return 0; };var hm_debug = function() { return "0"; };var hm_mailto = function() { return 0; };var hm_page_name = function() { return ""; };var hm_language_direction = function() { return "ltr"; };var hm_list_path = function() { return ""; };var hm_list_parent = function() { return ""; };var hm_msg_uid = function() { return Hm_Utils.get_from_global("msg_uid", ""); };var hm_encrypt_ajax_requests = function() { return ""; };var hm_encrypt_local_storage = function() { return ""; };var hm_web_root_path = function() { return ""; };var hm_flag_image_src = function() { return "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228%22%20height%3D%228%22%20viewBox%3D%220%200%208%208%22%3E%0A%20%20%3Cpath%20d%3D%22M0%200v8h1v-8h-1zm2%200v4h2v1h4l-2-1.969%202-2.031h-3v-1h-3z%22%20%2F%3E%0A%3C%2Fsvg%3E"; };var hm_check_dirty_flag = function() { return 0; };var hm_data_sources = function() { return []; };var hm_delete_prompt = function() { return true; };', implode($res->output_response));
$test->handler_response = array();
$res = $test->run();
$this->assertEquals(array('<script type="text/javascript">var globals = {};var hm_empty_folder = function() { return "So alone"; };var hm_mobile = function() { return 0; };var hm_debug = function() { return "0"; };var hm_mailto = function() { return 0; };var hm_page_name = function() { return ""; };var hm_language_direction = function() { return "ltr"; };var hm_list_path = function() { return ""; };var hm_list_parent = function() { return ""; };var hm_msg_uid = function() { return Hm_Utils.get_from_global("msg_uid", ""); };var hm_encrypt_ajax_requests = function() { return ""; };var hm_encrypt_local_storage = function() { return ""; };var hm_web_root_path = function() { return ""; };var hm_flag_image_src = function() { return "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228%22%20height%3D%228%22%20viewBox%3D%220%200%208%208%22%3E%0A%20%20%3Cpath%20d%3D%22M0%200v8h1v-8h-1zm2%200v4h2v1h4l-2-1.969%202-2.031h-3v-1h-3z%22%20%2F%3E%0A%3C%2Fsvg%3E"; };var hm_check_dirty_flag = function() { return 0; };var hm_data_sources = function() { return []; };var hm_delete_prompt = function() { return confirm("Are you sure?"); };</script>'), $res->output_response);
$this->assertStringStartsWith('<script type="text/javascript">var globals = {};var hm_empty_folder = function() { return "So alone"; };var hm_mobile = function() { return 0; };var hm_debug = function() { return "0"; };var hm_mailto = function() { return 0; };var hm_page_name = function() { return ""; };var hm_language_direction = function() { return "ltr"; };var hm_list_path = function() { return ""; };var hm_list_parent = function() { return ""; };var hm_msg_uid = function() { return Hm_Utils.get_from_global("msg_uid", ""); };var hm_encrypt_ajax_requests = function() { return ""; };var hm_encrypt_local_storage = function() { return ""; };var hm_web_root_path = function() { return ""; };var hm_flag_image_src = function() { return "data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228%22%20height%3D%228%22%20viewBox%3D%220%200%208%208%22%3E%0A%20%20%3Cpath%20d%3D%22M0%200v8h1v-8h-1zm2%200v4h2v1h4l-2-1.969%202-2.031h-3v-1h-3z%22%20%2F%3E%0A%3C%2Fsvg%3E"; };var hm_check_dirty_flag = function() { return 0; };var hm_data_sources = function() { return []; };var hm_delete_prompt = function() { return confirm("Are you sure?"); };', implode($res->output_response));
}
/**
* @preserveGlobalState disabled
Expand Down

0 comments on commit eea3c4c

Please sign in to comment.