Skip to content

Commit

Permalink
Merge pull request #806 from josaphatim/pb-failing-tests
Browse files Browse the repository at this point in the history
Fixed phpunit failing tests
  • Loading branch information
kroky authored Oct 31, 2023
2 parents 229ec17 + bbd4962 commit 028c0db
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions tests/phpunit/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public function test_decode_failed() {
* @runInSeparateProcess
*/
public function test_get_path() {
$this->assertEquals('./data/testuser.txt', $this->config->get_path('testuser'));
$this->assertEquals(APP_PATH.'tests/phpunit/data/testuser.txt', $this->config->get_path('testuser'));
}
/**
* @preserveGlobalState disabled
Expand Down Expand Up @@ -181,15 +181,15 @@ public function test_get_modules() {
* @runInSeparateProcess
*/
public function test_site_load() {
$config = new Hm_Site_Config_File('./data/siteconfig.rc');
$config = new Hm_Site_Config_File(APP_PATH.'tests/phpunit/data/siteconfig.rc');
$this->assertEquals(array('version' => VERSION, 'foo' => 'bar', 'default_setting_foo' => 'bar'), $config->dump());
}
/**
* @preserveGlobalState disabled
* @runInSeparateProcess
*/
public function test_get_user_defaults() {
$config = new Hm_Site_Config_File('./data/siteconfig.rc');
$config = new Hm_Site_Config_File(APP_PATH.'tests/phpunit/data/siteconfig.rc');
$this->assertEquals(array('version' => VERSION, 'foo' => 'bar', 'default_setting_foo' => 'bar'), $config->dump());
}
public function tearDown(): void {
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/mocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class Hm_Mock_Config {
public $mods = array();
public $user_defaults = array();
public $data = array(
'user_settings_dir' => './data',
'user_settings_dir' => APP_PATH.'tests/phpunit/data',
'default_language' => 'es',
'default_setting_inline_message' => true
);
Expand Down
8 changes: 4 additions & 4 deletions tests/phpunit/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ public function test_run_output_modules() {
* @runInSeparateProcess
*/
public function test_run_output_module() {
require '../../modules/core/setup.php';
require '../../modules/core/modules.php';
require APP_PATH.'/modules/core/setup.php';
require APP_PATH.'/modules/core/modules.php';
$request = new Hm_Mock_Request('HTTP');
$session = new Hm_Mock_Session();
Hm_Output_Modules::add('test', 'date', false, false, false, true, 'core');
Expand All @@ -205,8 +205,8 @@ public function test_run_output_module() {
* @runInSeparateProcess
*/
public function test_run_handler_modules() {
require '../../modules/core/setup.php';
require '../../modules/core/modules.php';
require APP_PATH.'/modules/core/setup.php';
require APP_PATH.'/modules/core/modules.php';
$request = new Hm_Mock_Request('HTTP');
$session = new Hm_Mock_Session();
Hm_Handler_Modules::add('test', 'date', false, false, false, true, 'core');
Expand Down
6 changes: 3 additions & 3 deletions tests/phpunit/modules/core/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class Hm_Test_Core_Functions extends TestCase {

public function setUp(): void {
require 'bootstrap.php';
require __DIR__.'/../../bootstrap.php';
require APP_PATH.'modules/core/modules.php';
}
/**
Expand Down Expand Up @@ -228,7 +228,7 @@ class Hm_Test_Core_Functions_Debug extends TestCase {

public function setUp(): void {
define('DEBUG_MODE', true);
require 'bootstrap.php';
require __DIR__.'/../../bootstrap.php';
require APP_PATH.'modules/core/modules.php';
}
/**
Expand All @@ -237,7 +237,7 @@ public function setUp(): void {
*/
public function test_get_ini_debug() {
$mock_config = new Hm_Mock_Config();
$mock_config->data['app_data_dir'] = './data';
$mock_config->data['app_data_dir'] = APP_PATH.'tests/phpunit/data';
$mock_config->data['foo.ini'] = 'bar';
$this->assertEquals(array('foo' => 'bar'), get_ini($mock_config, 'foo.ini'));
$this->assertEquals(array(), get_ini($mock_config, 'no.ini'));
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/modules/core/message_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class Hm_Test_Core_Message_Functions extends TestCase {

public function setUp(): void {
require 'bootstrap.php';
require __DIR__.'/../../bootstrap.php';
require APP_PATH.'modules/core/modules.php';
}
/**
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/modules/core/message_list_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Hm_Test_Core_Message_List_Functions extends TestCase {

public function setUp(): void {
date_default_timezone_set('UTC');
require 'bootstrap.php';
require __DIR__.'/../../bootstrap.php';
require APP_PATH.'modules/core/modules.php';
}
/**
Expand Down
14 changes: 7 additions & 7 deletions tests/phpunit/modules/core/modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
class Hm_Test_Core_Handler_Modules extends TestCase {

public function setUp(): void {
require 'bootstrap.php';
require 'helpers.php';
require __DIR__.'/../../bootstrap.php';
require __DIR__.'/../../helpers.php';
require APP_PATH.'modules/core/modules.php';
}
/**
Expand Down Expand Up @@ -466,7 +466,7 @@ public function test_load_user_data() {
public function test_save_user_data() {
$test = new Handler_Test('save_user_data', 'core');
$res = $test->run();
$this->assertEquals(array('user_settings_dir' => './data', 'default_language' => 'es', 'default_setting_inline_message' => true), $res->session->get('user_data'));
$this->assertEquals(array('user_settings_dir' => APP_PATH.'tests/phpunit/data', 'default_language' => 'es', 'default_setting_inline_message' => true), $res->session->get('user_data'));
}
/**
* @preserveGlobalState disabled
Expand Down Expand Up @@ -567,8 +567,8 @@ public function test_process_search_terms() {
class Hm_Test_Core_Output_Modules extends TestCase {

public function setUp(): void {
require 'bootstrap.php';
require 'helpers.php';
require __DIR__.'/../../bootstrap.php';
require __DIR__.'/../../helpers.php';
require APP_PATH.'modules/core/modules.php';
}
/**
Expand Down Expand Up @@ -1479,8 +1479,8 @@ public function test_message_list_end() {
class Hm_Test_Core_Output_Modules_Debug extends TestCase {
public function setUp(): void {
define('DEBUG_MODE', true);
require 'bootstrap.php';
require 'helpers.php';
require __DIR__.'/../../bootstrap.php';
require __DIR__.'/../../helpers.php';
require APP_PATH.'modules/core/modules.php';
}
/**
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/modules/imap/hm-imap.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Hm_Test_Hm_IMAP extends TestCase {

public function setUp(): void {
define('IMAP_TEST', true);
require 'bootstrap.php';
require __DIR__.'/../../bootstrap.php';
require APP_PATH.'modules/imap/hm-imap.php';
require APP_PATH.'modules/core/message_functions.php';
$this->create();
Expand Down

0 comments on commit 028c0db

Please sign in to comment.