Unverified Commit dba0ea26 authored by Sergei Morozov's avatar Sergei Morozov Committed by GitHub

Merge pull request #4201 from morozov/phpunit-9.3

Update PHPUnit to 9.3
parents e7c4149a 1946a1e1
<?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/schema/9.3.xsd"
colors="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
......@@ -28,9 +28,9 @@
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">../../lib</directory>
</whitelist>
</filter>
<coverage>
<include>
<directory suffix=".php">../../lib/Doctrine</directory>
</include>
</coverage>
</phpunit>
<?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/schema/9.3.xsd"
colors="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
......@@ -28,9 +28,9 @@
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">../../lib</directory>
</whitelist>
</filter>
<coverage>
<include>
<directory suffix=".php">../../lib/Doctrine</directory>
</include>
</coverage>
</phpunit>
This diff is collapsed.
......@@ -12,7 +12,7 @@
Example: phpunit -c mysqlconf.xml
-->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/schema/9.3.xsd"
colors="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
......@@ -48,9 +48,9 @@
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">lib/Doctrine</directory>
</whitelist>
</filter>
<coverage>
<include>
<directory suffix=".php">lib/Doctrine</directory>
</include>
</coverage>
</phpunit>
......@@ -54,7 +54,7 @@ final class LoggingTest extends TestCase
$logger->expects($this->once())
->method('startQuery')
->with($this->equalTo($expectedSQL), $this->equalTo([]));
$logger->expects($this->at(1))
$logger->expects($this->once())
->method('stopQuery');
$connection = new Connection([], $driver);
......
......@@ -152,7 +152,7 @@ class ConnectionTest extends DbalTestCase
$eventManager->addEventListener([Events::postConnect], $listenerMock);
$driverMock = $this->createMock(Driver::class);
$driverMock->expects($this->at(0))
$driverMock->expects($this->once())
->method('connect');
$conn = new Connection([], $driverMock, new Configuration(), $eventManager);
......@@ -846,13 +846,11 @@ EOF
$originalException = new Exception('Original exception');
$fallbackException = new Exception('Fallback exception');
$driverMock->expects($this->at(0))
->method('connect')
->willThrowException($originalException);
$driverMock->expects($this->at(1))
->method('connect')
->willThrowException($fallbackException);
$driverMock->method('connect')
->will(self::onConsecutiveCalls(
self::throwException($originalException),
self::throwException($fallbackException)
));
$this->expectExceptionMessage($originalException->getMessage());
......
......@@ -33,23 +33,12 @@ class OCI8StatementTest extends DbalTestCase
->disableOriginalConstructor()
->getMock();
$statement->expects($this->at(0))
$statement->expects($this->exactly(3))
->method('bindValue')
->with(
$this->equalTo(1),
$this->equalTo($params[0])
);
$statement->expects($this->at(1))
->method('bindValue')
->with(
$this->equalTo(2),
$this->equalTo($params[1])
);
$statement->expects($this->at(2))
->method('bindValue')
->with(
$this->equalTo(3),
$this->equalTo($params[2])
->withConsecutive(
[1, $params[0]],
[2, $params[1]],
[3, $params[2]],
);
// the return value is irrelevant to the test
......
......@@ -1174,29 +1174,17 @@ class ComparatorTest extends TestCase
->method('getNamespaces')
->will($this->returnValue(['foo', 'bar']));
$fromSchema->expects($this->at(0))
->method('hasNamespace')
->with('bar')
->will($this->returnValue(true));
$fromSchema->expects($this->at(1))
->method('hasNamespace')
->with('baz')
->will($this->returnValue(false));
$fromSchema->method('hasNamespace')
->withConsecutive(['bar'], ['baz'])
->willReturnOnConsecutiveCalls(true, false);
$toSchema->expects($this->once())
->method('getNamespaces')
->will($this->returnValue(['bar', 'baz']));
$toSchema->expects($this->at(1))
->method('hasNamespace')
->with('foo')
->will($this->returnValue(false));
$toSchema->expects($this->at(2))
->method('hasNamespace')
->with('bar')
->will($this->returnValue(true));
$toSchema->method('hasNamespace')
->withConsecutive(['foo'], ['bar'])
->willReturnOnConsecutiveCalls(false, true);
$expected = new SchemaDiff();
$expected->fromSchema = $fromSchema;
......
......@@ -371,7 +371,7 @@ class SchemaTest extends TestCase
[$schema->getSequence('war')]
);
self::assertNull($schema->visit($visitor));
$schema->visit($visitor);
}
public function testVisitsNamespaceVisitor(): void
......@@ -392,34 +392,24 @@ class SchemaTest extends TestCase
->method('acceptSchema')
->with($schema);
$visitor->expects($this->at(1))
$visitor->expects($this->exactly(3))
->method('acceptNamespace')
->with('foo');
->withConsecutive(['foo'], ['bar'], ['bla']);
$visitor->expects($this->at(2))
->method('acceptNamespace')
->with('bar');
$visitor->expects($this->at(3))
->method('acceptNamespace')
->with('bla');
$visitor->expects($this->at(4))
$visitor->expects($this->exactly(2))
->method('acceptTable')
->with($schema->getTable('baz'));
$visitor->expects($this->at(5))
->method('acceptTable')
->with($schema->getTable('bla.bloo'));
$visitor->expects($this->at(6))
->method('acceptSequence')
->with($schema->getSequence('moo'));
->withConsecutive(
[$schema->getTable('baz')],
[$schema->getTable('bla.bloo')]
);
$visitor->expects($this->at(7))
$visitor->expects($this->exactly(2))
->method('acceptSequence')
->with($schema->getSequence('war'));
->withConsecutive(
[$schema->getSequence('moo')],
[$schema->getSequence('war')]
);
self::assertNull($schema->visit($visitor));
$schema->visit($visitor);
}
}
......@@ -45,19 +45,20 @@ class CreateSchemaSqlCollectorTest extends TestCase
->willReturn(['foo']);
}
public function testAcceptsNamespace(): void
public function testAcceptsNamespaceDoesNotSupportSchemas(): void
{
$this->platformMock->expects($this->at(0))
->method('supportsSchemas')
->will($this->returnValue(false));
$this->platformMock->expects($this->at(1))
->method('supportsSchemas')
->will($this->returnValue(true));
$this->platformMock->method('supportsSchemas')
->willReturn(false);
$this->visitor->acceptNamespace('foo');
self::assertEmpty($this->visitor->getQueries());
}
public function testAcceptsNamespaceSupportsSchemas(): void
{
$this->platformMock->method('supportsSchemas')
->willReturn(true);
$this->visitor->acceptNamespace('foo');
......@@ -73,15 +74,10 @@ class CreateSchemaSqlCollectorTest extends TestCase
self::assertSame(['foo'], $this->visitor->getQueries());
}
public function testAcceptsForeignKey(): void
public function testAcceptsForeignKeyDoesNotSupportCreateDropForeignKeyConstraints(): void
{
$this->platformMock->expects($this->at(0))
->method('supportsCreateDropForeignKeyConstraints')
->will($this->returnValue(false));
$this->platformMock->expects($this->at(1))
->method('supportsCreateDropForeignKeyConstraints')
->will($this->returnValue(true));
$this->platformMock->method('supportsCreateDropForeignKeyConstraints')
->willReturn(false);
$table = $this->createTableMock();
$foreignKey = $this->createForeignKeyConstraintMock();
......@@ -89,6 +85,15 @@ class CreateSchemaSqlCollectorTest extends TestCase
$this->visitor->acceptForeignKey($table, $foreignKey);
self::assertEmpty($this->visitor->getQueries());
}
public function testAcceptsForeignKeySupportsCreateDropForeignKeyConstraints(): void
{
$this->platformMock->method('supportsCreateDropForeignKeyConstraints')
->willReturn(true);
$table = $this->createTableMock();
$foreignKey = $this->createForeignKeyConstraintMock();
$this->visitor->acceptForeignKey($table, $foreignKey);
......
......@@ -63,13 +63,11 @@ class PoolingShardManagerTest extends TestCase
$shardId = 10;
$conn = $this->createConnectionMock();
$conn->expects($this->at(0))
->method('getParams')
$conn->method('getParams')
->willReturn(['shardChoser' => $this->createPassthroughShardChoser()]);
$conn->expects($this->at(1))
->method('connect')
->with($this->equalTo($shardId));
$conn->method('connect')
->with($shardId);
$shardManager = new PoolingShardManager($conn);
$shardManager->selectShard($shardId);
......@@ -99,22 +97,24 @@ class PoolingShardManagerTest extends TestCase
$types = [1];
$conn = $this->createConnectionMock();
$conn->expects($this->at(0))->method('getParams')->will($this->returnValue(
['shards' => [['id' => 1], ['id' => 2]], 'shardChoser' => $this->createPassthroughShardChoser()]
));
$conn->expects($this->at(1))->method('getParams')->will($this->returnValue(
['shards' => [['id' => 1], ['id' => 2]], 'shardChoser' => $this->createPassthroughShardChoser()]
));
$conn->expects($this->at(2))->method('connect')->with($this->equalTo(1));
$conn->expects($this->at(3))
->method('fetchAllAssociative')
->with($this->equalTo($sql), $this->equalTo($params), $this->equalTo($types))
->will($this->returnValue([['id' => 1]]));
$conn->expects($this->at(4))->method('connect')->with($this->equalTo(2));
$conn->expects($this->at(5))
->method('fetchAllAssociative')
->with($this->equalTo($sql), $this->equalTo($params), $this->equalTo($types))
->will($this->returnValue([['id' => 2]]));
$conn->method('getParams')->willReturn([
'shards' => [
['id' => 1],
['id' => 2],
],
'shardChoser' => $this->createPassthroughShardChoser(),
]);
$conn->method('connect')
->withConsecutive([1], [2]);
$conn->method('fetchAllAssociative')
->with($sql, $params, $types)
->willReturnOnConsecutiveCalls(
[['id' => 1]],
[['id' => 2]],
);
$shardManager = new PoolingShardManager($conn);
$result = $shardManager->queryAll($sql, $params, $types);
......@@ -129,22 +129,24 @@ class PoolingShardManagerTest extends TestCase
$types = [1];
$conn = $this->createConnectionMock();
$conn->expects($this->at(0))->method('getParams')->will($this->returnValue(
['shards' => [['id' => 1], ['id' => 2]], 'shardChoser' => $this->createStaticShardChooser()]
));
$conn->expects($this->at(1))->method('getParams')->will($this->returnValue(
['shards' => [['id' => 1], ['id' => 2]], 'shardChoser' => $this->createStaticShardChooser()]
));
$conn->expects($this->at(2))->method('connect')->with($this->equalTo(1));
$conn->expects($this->at(3))
->method('fetchAllAssociative')
->with($this->equalTo($sql), $this->equalTo($params), $this->equalTo($types))
->will($this->returnValue([['id' => 1]]));
$conn->expects($this->at(4))->method('connect')->with($this->equalTo(2));
$conn->expects($this->at(5))
->method('fetchAllAssociative')
->with($this->equalTo($sql), $this->equalTo($params), $this->equalTo($types))
->will($this->returnValue([['id' => 2]]));
$conn->method('getParams')->willReturn([
'shards' => [
['id' => 1],
['id' => 2],
],
'shardChoser' => $this->createStaticShardChooser(),
]);
$conn->method('connect')
->withConsecutive([1], [2]);
$conn->method('fetchAllAssociative')
->with($sql, $params, $types)
->willReturnOnConsecutiveCalls(
[['id' => 1]],
[['id' => 2]],
);
$shardManager = new PoolingShardManager($conn);
$result = $shardManager->queryAll($sql, $params, $types);
......
......@@ -60,7 +60,8 @@ class SQLAzureShardManagerTest extends TestCase
],
]);
$conn->expects($this->at(1))->method('isTransactionActive')->will($this->returnValue(true));
$conn->method('isTransactionActive')
->willReturn(true);
$this->expectException(ShardingException::class);
$this->expectExceptionMessage('Cannot switch shard during an active transaction.');
......@@ -79,8 +80,12 @@ class SQLAzureShardManagerTest extends TestCase
],
]);
$conn->expects($this->at(1))->method('isTransactionActive')->will($this->returnValue(false));
$conn->expects($this->at(2))->method('exec')->with($this->equalTo('USE FEDERATION ROOT WITH RESET'));
$conn->method('isTransactionActive')
->willReturn(false);
$conn->expects($this->once())
->method('exec')
->with('USE FEDERATION ROOT WITH RESET');
$sm = new SQLAzureShardManager($conn);
$sm->selectGlobal();
......@@ -96,7 +101,8 @@ class SQLAzureShardManagerTest extends TestCase
],
]);
$conn->expects($this->at(1))->method('isTransactionActive')->will($this->returnValue(true));
$conn->method('isTransactionActive')
->willReturn(true);
$this->expectException(ShardingException::class);
$this->expectExceptionMessage('Cannot switch shard during an active transaction.');
......@@ -118,7 +124,9 @@ class SQLAzureShardManagerTest extends TestCase
->onlyMethods(['getParams', 'exec', 'isTransactionActive'])
->disableOriginalConstructor()
->getMock();
$conn->expects($this->at(0))->method('getParams')->will($this->returnValue($params));
$conn->method('getParams')
->willReturn($params);
return $conn;
}
......
<?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/schema/9.3.xsd"
colors="true"
bootstrap="../../vendor/autoload.php"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
failOnRisky="true"
......@@ -24,11 +23,11 @@
</testsuite>
</testsuites>
<filter>
<whitelist>
<coverage>
<include>
<directory suffix=".php">../../lib/Doctrine</directory>
</whitelist>
</filter>
</include>
</coverage>
<groups>
<exclude>
......
<?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/schema/9.3.xsd"
colors="true"
bootstrap="../../vendor/autoload.php"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
failOnRisky="true"
......@@ -24,11 +23,11 @@
</testsuite>
</testsuites>
<filter>
<whitelist>
<coverage>
<include>
<directory suffix=".php">../../lib/Doctrine</directory>
</whitelist>
</filter>
</include>
</coverage>
<groups>
<exclude>
......
<?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/schema/9.3.xsd"
colors="true"
bootstrap="../../vendor/autoload.php"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
failOnRisky="true"
......@@ -24,11 +23,11 @@
</testsuite>
</testsuites>
<filter>
<whitelist>
<coverage>
<include>
<directory suffix=".php">../../lib/Doctrine</directory>
</whitelist>
</filter>
</include>
</coverage>
<groups>
<exclude>
......
<?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/schema/9.3.xsd"
colors="true"
bootstrap="../../vendor/autoload.php"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
failOnRisky="true"
......@@ -24,11 +23,11 @@
</testsuite>
</testsuites>
<filter>
<whitelist>
<coverage>
<include>
<directory suffix=".php">../../lib/Doctrine</directory>
</whitelist>
</filter>
</include>
</coverage>
<groups>
<exclude>
......
<?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/schema/9.3.xsd"
colors="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
......@@ -23,11 +23,11 @@
</testsuite>
</testsuites>
<filter>
<whitelist>
<coverage>
<include>
<directory suffix=".php">../../lib/Doctrine</directory>
</whitelist>
</filter>
</include>
</coverage>
<groups>
<exclude>
......
<?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/schema/9.3.xsd"
colors="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
......@@ -23,11 +23,11 @@
</testsuite>
</testsuites>
<filter>
<whitelist>
<coverage>
<include>
<directory suffix=".php">../../lib/Doctrine</directory>
</whitelist>
</filter>
</include>
</coverage>
<groups>
<exclude>
......
<?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/schema/9.3.xsd"
colors="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
......@@ -23,11 +23,11 @@
</testsuite>
</testsuites>
<filter>
<whitelist>
<coverage>
<include>
<directory suffix=".php">../../lib/Doctrine</directory>
</whitelist>
</filter>
</include>
</coverage>
<groups>
<exclude>
......
<?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/schema/9.3.xsd"
colors="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
......@@ -23,11 +23,11 @@
</testsuite>
</testsuites>
<filter>
<whitelist>
<coverage>
<include>
<directory suffix=".php">../../lib/Doctrine</directory>
</whitelist>
</filter>
</include>
</coverage>
<groups>
<exclude>
......
<?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/schema/9.3.xsd"
colors="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
......@@ -23,11 +23,11 @@
</testsuite>
</testsuites>
<filter>
<whitelist>
<coverage>
<include>
<directory suffix=".php">../../lib/Doctrine</directory>
</whitelist>
</filter>
</include>
</coverage>
<groups>
<exclude>
......
<?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/schema/9.3.xsd"
colors="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
......@@ -23,11 +23,11 @@
</testsuite>
</testsuites>
<filter>
<whitelist>
<coverage>
<include>
<directory suffix=".php">../../lib/Doctrine</directory>
</whitelist>
</filter>
</include>
</coverage>
<groups>
<exclude>
......
<?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/schema/9.3.xsd"
colors="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
......@@ -22,11 +22,11 @@
</testsuite>
</testsuites>
<filter>
<whitelist>
<coverage>
<include>
<directory suffix=".php">../../lib/Doctrine</directory>
</whitelist>
</filter>
</include>
</coverage>
<groups>
<exclude>
......
<?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/schema/9.3.xsd"
colors="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
......@@ -17,11 +17,11 @@
</testsuite>
</testsuites>
<filter>
<whitelist>
<coverage>
<include>
<directory suffix=".php">../../lib/Doctrine</directory>
</whitelist>
</filter>
</include>
</coverage>
<groups>
<exclude>
......
<?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/phpunit.xsd"
xsi:noNamespaceSchemaLocation="../../vendor/phpunit/phpunit/schema/9.3.xsd"
colors="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
......@@ -23,11 +23,11 @@
</testsuite>
</testsuites>
<filter>
<whitelist>
<coverage>
<include>
<directory suffix=".php">../../lib/Doctrine</directory>
</whitelist>
</filter>
</include>
</coverage>
<groups>
<exclude>
......
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