mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[ticket/13740] Fix test stubs
PHPBB3-13740
This commit is contained in:
parent
612eead5a9
commit
1c01252b5d
3 changed files with 14 additions and 25 deletions
|
@ -28,10 +28,6 @@ class phpbb_installer_database_helper_test extends phpbb_test_case
|
||||||
$filesystem = new \phpbb\filesystem\filesystem();
|
$filesystem = new \phpbb\filesystem\filesystem();
|
||||||
$phpbb_root_path = '';
|
$phpbb_root_path = '';
|
||||||
$this->database_helper = new \phpbb\install\helper\database($filesystem, $phpbb_root_path);
|
$this->database_helper = new \phpbb\install\helper\database($filesystem, $phpbb_root_path);
|
||||||
|
|
||||||
// I used oracle because it tolerates the shortest table prefixes
|
|
||||||
// so it's the simplest to write test cases for
|
|
||||||
$this->dbms_mock = $this->getMock('\phpbb\db\driver\oracle');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -65,7 +61,7 @@ class phpbb_installer_database_helper_test extends phpbb_test_case
|
||||||
*/
|
*/
|
||||||
public function test_validate_table_prefix($expected, $test_string)
|
public function test_validate_table_prefix($expected, $test_string)
|
||||||
{
|
{
|
||||||
$this->assertEquals($expected, $this->database_helper->validate_table_prefix($this->dbms_mock, $test_string));
|
$this->assertEquals($expected, $this->database_helper->validate_table_prefix('oracle', $test_string));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Data provider for the remove comments function
|
// Data provider for the remove comments function
|
||||||
|
@ -100,17 +96,9 @@ class phpbb_installer_database_helper_test extends phpbb_test_case
|
||||||
'abcd "efgh"' . "\n" . 'qwerty',
|
'abcd "efgh"' . "\n" . 'qwerty',
|
||||||
'SELECT * FROM table',
|
'SELECT * FROM table',
|
||||||
),
|
),
|
||||||
'abcd "efgh"
|
'abcd "efgh"' . "\n" .
|
||||||
qwerty;
|
'qwerty' . "\n" .
|
||||||
SELECT * FROM table',
|
'SELECT * FROM table',
|
||||||
';',
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
array(
|
|
||||||
'SELECT * FROM table1',
|
|
||||||
'SELECT * FROM table2 WHERE i_am="king"',
|
|
||||||
),
|
|
||||||
'SELECT * FROM table1; SELECT * FROM table2 WHERE i_am="king"',
|
|
||||||
';',
|
';',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -25,11 +25,11 @@ class phpbb_installer_config_test extends phpbb_test_case
|
||||||
$phpbb_root_path = __DIR__ . './../../phpBB/';
|
$phpbb_root_path = __DIR__ . './../../phpBB/';
|
||||||
$filesystem = $this->getMock('\phpbb\filesystem\filesystem');
|
$filesystem = $this->getMock('\phpbb\filesystem\filesystem');
|
||||||
$php_ini = $this->getMockBuilder('\phpbb\php\ini')
|
$php_ini = $this->getMockBuilder('\phpbb\php\ini')
|
||||||
->method('get_int')
|
|
||||||
->willReturn(-1)
|
|
||||||
->method('get_bytes')
|
|
||||||
->willReturn(-1)
|
|
||||||
->getMock();
|
->getMock();
|
||||||
|
$php_ini->method('get_int')
|
||||||
|
->willReturn(-1);
|
||||||
|
$php_ini->method('get_bytes')
|
||||||
|
->willReturn(-1);
|
||||||
|
|
||||||
$this->config = new config($filesystem, $php_ini, $phpbb_root_path);
|
$this->config = new config($filesystem, $php_ini, $phpbb_root_path);
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,8 @@ class phpbb_installer_config_test extends phpbb_test_case
|
||||||
$this->config->set_task_progress_count(10);
|
$this->config->set_task_progress_count(10);
|
||||||
$this->config->increment_current_task_progress();
|
$this->config->increment_current_task_progress();
|
||||||
|
|
||||||
$this->assertContains(array('current_task_progress' => 1), $this->config->get_progress_data());
|
$progress_data = $this->config->get_progress_data();
|
||||||
|
$this->assertEquals(1, $progress_data['current_task_progress']);
|
||||||
|
|
||||||
$this->config->increment_current_task_progress(2);
|
$this->config->increment_current_task_progress(2);
|
||||||
|
|
||||||
|
|
|
@ -16,14 +16,14 @@ class phpbb_installer_navigation_provider_test extends phpbb_test_case
|
||||||
public function test_navigation()
|
public function test_navigation()
|
||||||
{
|
{
|
||||||
// Mock nav interface
|
// Mock nav interface
|
||||||
$nav_mock = $this->getMockBuilder('\phpbb\install\helper\navigation\navigation_interface')
|
$nav_stub = $this->getMockBuilder('\phpbb\install\helper\navigation\navigation_interface')
|
||||||
->method('get')
|
|
||||||
->willReturn(array('foo' => 'bar'))
|
|
||||||
->getMock();
|
->getMock();
|
||||||
|
$nav_stub->method('get')
|
||||||
|
->willReturn(array('foo' => 'bar'));
|
||||||
|
|
||||||
// Set up dependencies
|
// Set up dependencies
|
||||||
$container = new phpbb_mock_container_builder();
|
$container = new phpbb_mock_container_builder();
|
||||||
$container->set('foo', $nav_mock);
|
$container->set('foo', $nav_stub);
|
||||||
$nav_collection = new \phpbb\di\service_collection($container);
|
$nav_collection = new \phpbb\di\service_collection($container);
|
||||||
$nav_collection->add('foo');
|
$nav_collection->add('foo');
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue