mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-20 23:41:29 +02:00
[ticket/17535] Update PHPUnit to v.10
PHPBB-17535
This commit is contained in:
@@ -31,15 +31,23 @@ class phpbb_dbal_connect_test extends phpbb_database_test_case
|
||||
// Failure to connect results in a trigger_error call in dbal.
|
||||
// phpunit converts triggered errors to exceptions.
|
||||
// In particular there should be no fatals here.
|
||||
try
|
||||
|
||||
|
||||
if ($db->get_sql_layer() === 'mysqli')
|
||||
{
|
||||
$db->sql_connect($config['dbhost'], 'phpbbogus', 'phpbbogus', 'phpbbogus', $config['dbport']);
|
||||
$this->assertFalse(true);
|
||||
$this->setExpectedTriggerError(E_WARNING);
|
||||
}
|
||||
catch (Exception $e)
|
||||
else if ($db->get_sql_layer() !== 'sqlite3')
|
||||
{
|
||||
// should have a legitimate message
|
||||
$this->assertNotEmpty($e->getMessage());
|
||||
$this->setExpectedTriggerError(E_USER_ERROR);
|
||||
}
|
||||
|
||||
// For SQLite3, connection will be successful anyway as phpBB driver uses SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE flags
|
||||
$result = $db->sql_connect($config['dbhost'], 'phpbbogus', 'phpbbogus', 'phpbbogus', $config['dbport']);
|
||||
|
||||
if ($db->get_sql_layer() === 'sqlite3')
|
||||
{
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -404,11 +404,19 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case
|
||||
->will($this->returnValue(true));
|
||||
|
||||
// drop tables
|
||||
$db_tools->expects($this->exactly(2))->method('schema_drop_table')
|
||||
->withConsecutive(
|
||||
[$this->isInstanceOf(Schema::class), 'dropped_table_1', true],
|
||||
[$this->isInstanceOf(Schema::class), 'dropped_table_2', true]
|
||||
);
|
||||
$matcher = $this->exactly(2);
|
||||
$db_tools->expects($matcher)->method('schema_drop_table')
|
||||
->willReturnCallback(function() use ($matcher) {
|
||||
$args = func_get_args();
|
||||
$schema = array_shift($args);
|
||||
$this->assertInstanceOf(\Doctrine\DBAL\Schema\Schema::class, $schema);
|
||||
match($matcher->numberOfInvocations())
|
||||
{
|
||||
1 => $this->assertEquals($args, ['dropped_table_1', true]),
|
||||
2 => $this->assertEquals($args, ['dropped_table_2', true]),
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
$db_tools->perform_schema_changes(array(
|
||||
'drop_tables' => array(
|
||||
@@ -432,11 +440,18 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case
|
||||
->will($this->returnValue(true));
|
||||
|
||||
// drop columns
|
||||
$db_tools->expects($this->exactly(2))->method('schema_column_remove')
|
||||
->withConsecutive(
|
||||
[$this->isInstanceOf(Schema::class), 'existing_table', 'dropped_column_1', true],
|
||||
[$this->isInstanceOf(Schema::class), 'existing_table', 'dropped_column_2', true]
|
||||
);
|
||||
$matcher = $this->exactly(2);
|
||||
$db_tools->expects($matcher)->method('schema_column_remove')
|
||||
->willReturnCallback(function() use ($matcher) {
|
||||
$args = func_get_args();
|
||||
$schema = array_shift($args);
|
||||
$this->assertInstanceOf(\Doctrine\DBAL\Schema\Schema::class, $schema);
|
||||
match($matcher->numberOfInvocations()) {
|
||||
1 => $this->assertEquals($args, ['existing_table', 'dropped_column_1', true]),
|
||||
2 => $this->assertEquals($args, ['existing_table', 'dropped_column_2', true]),
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
$db_tools->perform_schema_changes(array(
|
||||
'drop_columns' => array(
|
||||
|
Reference in New Issue
Block a user