Unverified Commit 2cfd54ae authored by Sergei Morozov's avatar Sergei Morozov Committed by GitHub

Merge pull request #4080 from morozov/phpunit-9.2

Update PHPUnit to 9.2
parents b8d0bd68 24056154
This diff is collapsed.
......@@ -6,7 +6,6 @@ namespace Doctrine\Tests\DBAL\Functional\Driver\IBMDB2;
use Doctrine\DBAL\Driver\IBMDB2\DB2Driver;
use Doctrine\Tests\DbalFunctionalTestCase;
use PHPUnit\Framework\Error\Notice;
use function extension_loaded;
......@@ -34,7 +33,7 @@ class DB2StatementTest extends DbalFunctionalTestCase
// unwrap the statement to prevent the wrapper from handling the PHPUnit-originated exception
$wrappedStmt = $stmt->getWrappedStatement();
$this->expectException(Notice::class);
$this->expectNotice();
$wrappedStmt->execute([[]]);
}
}
......@@ -129,7 +129,11 @@ class PortabilityTest extends DbalFunctionalTestCase
*/
public function assertFetchResultRow(array $row): void
{
self::assertContains($row['test_int'], [1, 2], 'Primary key test_int should either be 1 or 2.');
self::assertThat($row['test_int'], self::logicalOr(
self::equalTo(1),
self::equalTo(2)
));
self::assertArrayHasKey('test_string', $row, 'Case should be lowered.');
self::assertEquals(3, strlen($row['test_string']), 'test_string should be rtrimed to length of three for CHAR(32) column.');
self::assertNull($row['test_null']);
......
......@@ -24,7 +24,10 @@ class SQLAnywhereSchemaManagerTest extends SchemaManagerFunctionalTestCase
self::assertCount(1, $views, 'Database has to have one view.');
self::assertInstanceOf(View::class, $views[$name]);
self::assertEquals($name, $views[$name]->getName());
self::assertRegExp('/^SELECT \* from "?DBA"?\."?view_test_table"?$/', $views[$name]->getSql());
self::assertMatchesRegularExpression(
'/^SELECT \* from "?DBA"?\."?view_test_table"?$/',
$views[$name]->getSql()
);
}
public function testDropAndCreateAdvancedIndex(): void
......
......@@ -35,7 +35,7 @@ class SqliteSchemaManagerTest extends SchemaManagerFunctionalTestCase
$this->schemaManager->createDatabase($path);
self::assertFileExists($path);
$this->schemaManager->dropDatabase($path);
self::assertFileNotExists($path);
self::assertFileDoesNotExist($path);
}
/**
......@@ -59,7 +59,7 @@ class SqliteSchemaManagerTest extends SchemaManagerFunctionalTestCase
$this->schemaManager->dropDatabase('test_drop_database');
self::assertFileNotExists('test_drop_database');
self::assertFileDoesNotExist('test_drop_database');
unset($connection);
}
......
......@@ -73,8 +73,8 @@ class RunSqlCommandTest extends TestCase
]);
$this->assertSame(0, $exitCode);
self::assertRegExp('@int.*1.*@', $this->commandTester->getDisplay());
self::assertRegExp('@array.*1.*@', $this->commandTester->getDisplay());
self::assertMatchesRegularExpression('@int.*1.*@', $this->commandTester->getDisplay());
self::assertMatchesRegularExpression('@array.*1.*@', $this->commandTester->getDisplay());
}
public function testUpdateStatementsPrintsAffectedLines(): void
......@@ -86,8 +86,8 @@ class RunSqlCommandTest extends TestCase
'sql' => 'UPDATE foo SET bar = 42',
]);
self::assertRegExp('@int.*42.*@', $this->commandTester->getDisplay());
self::assertNotRegExp('@array.*1.*@', $this->commandTester->getDisplay());
self::assertMatchesRegularExpression('@int.*42.*@', $this->commandTester->getDisplay());
self::assertDoesNotMatchRegularExpression('@array.*1.*@', $this->commandTester->getDisplay());
}
private function expectConnectionExecuteUpdate(): void
......@@ -124,7 +124,7 @@ class RunSqlCommandTest extends TestCase
'--force-fetch' => true,
]);
self::assertRegExp('@int.*1.*@', $this->commandTester->getDisplay());
self::assertRegExp('@array.*1.*@', $this->commandTester->getDisplay());
self::assertMatchesRegularExpression('@int.*1.*@', $this->commandTester->getDisplay());
self::assertMatchesRegularExpression('@array.*1.*@', $this->commandTester->getDisplay());
}
}
......@@ -31,7 +31,7 @@ class ConversionExceptionTest extends TestCase
$exception = ConversionException::conversionFailedInvalidType($scalarValue, 'foo', ['bar', 'baz']);
self::assertInstanceOf(ConversionException::class, $exception);
self::assertRegExp(
self::assertMatchesRegularExpression(
'/^Could not convert PHP value \'.*\' of type \'(string|boolean|float|double|integer)\' to type \'foo\'. '
. 'Expected one of the following types: bar, baz$/',
$exception->getMessage()
......@@ -48,7 +48,7 @@ class ConversionExceptionTest extends TestCase
$exception = ConversionException::conversionFailedInvalidType($nonScalar, 'foo', ['bar', 'baz']);
self::assertInstanceOf(ConversionException::class, $exception);
self::assertRegExp(
self::assertMatchesRegularExpression(
'/^Could not convert PHP value of type \'(.*)\' to type \'foo\'. '
. 'Expected one of the following types: bar, baz$/',
$exception->getMessage()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment