mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[ticket/16549] Fix database testcase transactions handling, fix indentations
PHPBB3-16549
This commit is contained in:
parent
ba9fd7f5df
commit
72a39920c7
3 changed files with 13 additions and 9 deletions
|
@ -390,8 +390,8 @@ abstract class phpbb_database_test_case extends TestCase
|
||||||
* PHPUnit deprecates several methods and properties in its recent versions
|
* PHPUnit deprecates several methods and properties in its recent versions
|
||||||
* Provide BC layer to be able to test in multiple environment settings
|
* Provide BC layer to be able to test in multiple environment settings
|
||||||
*/
|
*/
|
||||||
public function expectException(string $exception): void
|
public function expectException(string $exception): void
|
||||||
{
|
{
|
||||||
if (version_compare(self::$phpunit_version, '9.0', '>='))
|
if (version_compare(self::$phpunit_version, '9.0', '>='))
|
||||||
{
|
{
|
||||||
switch ($exception) {
|
switch ($exception) {
|
||||||
|
@ -426,8 +426,8 @@ abstract class phpbb_database_test_case extends TestCase
|
||||||
* PHPUnit deprecates several methods and properties in its recent versions
|
* PHPUnit deprecates several methods and properties in its recent versions
|
||||||
* Provide BC layer to be able to test in multiple environment settings
|
* Provide BC layer to be able to test in multiple environment settings
|
||||||
*/
|
*/
|
||||||
public static function assertFileNotExists(string $filename, string $message = ''): void
|
public static function assertFileNotExists(string $filename, string $message = ''): void
|
||||||
{
|
{
|
||||||
if (version_compare(self::$phpunit_version, '9.0', '>='))
|
if (version_compare(self::$phpunit_version, '9.0', '>='))
|
||||||
{
|
{
|
||||||
parent::assertFileDoesNotExist($filename, $message);
|
parent::assertFileDoesNotExist($filename, $message);
|
||||||
|
|
|
@ -393,12 +393,16 @@ class phpbb_database_test_connection_manager
|
||||||
{
|
{
|
||||||
$this->pdo->beginTransaction();
|
$this->pdo->beginTransaction();
|
||||||
}
|
}
|
||||||
else if ($query === 'commit')
|
else if ($query === 'commit' && $this->pdo->inTransaction())
|
||||||
{
|
{
|
||||||
$this->pdo->commit();
|
$this->pdo->commit();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (!$this->pdo->inTransaction())
|
||||||
|
{
|
||||||
|
$this->pdo->beginTransaction();
|
||||||
|
}
|
||||||
$this->pdo->exec($query);
|
$this->pdo->exec($query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,8 +88,8 @@ class phpbb_test_case extends TestCase
|
||||||
* PHPUnit deprecates several methods and properties in its recent versions
|
* PHPUnit deprecates several methods and properties in its recent versions
|
||||||
* Provide BC layer to be able to test in multiple environment settings
|
* Provide BC layer to be able to test in multiple environment settings
|
||||||
*/
|
*/
|
||||||
public function expectException(string $exception): void
|
public function expectException(string $exception): void
|
||||||
{
|
{
|
||||||
if (version_compare(self::$phpunit_version, '9.0', '>='))
|
if (version_compare(self::$phpunit_version, '9.0', '>='))
|
||||||
{
|
{
|
||||||
switch ($exception) {
|
switch ($exception) {
|
||||||
|
@ -124,8 +124,8 @@ class phpbb_test_case extends TestCase
|
||||||
* PHPUnit deprecates several methods and properties in its recent versions
|
* PHPUnit deprecates several methods and properties in its recent versions
|
||||||
* Provide BC layer to be able to test in multiple environment settings
|
* Provide BC layer to be able to test in multiple environment settings
|
||||||
*/
|
*/
|
||||||
public static function assertFileNotExists(string $filename, string $message = ''): void
|
public static function assertFileNotExists(string $filename, string $message = ''): void
|
||||||
{
|
{
|
||||||
if (version_compare(self::$phpunit_version, '9.0', '>='))
|
if (version_compare(self::$phpunit_version, '9.0', '>='))
|
||||||
{
|
{
|
||||||
parent::assertFileDoesNotExist($filename, $message);
|
parent::assertFileDoesNotExist($filename, $message);
|
||||||
|
|
Loading…
Add table
Reference in a new issue