Skip to content

Commit 2178612

Browse files
authored
Merge pull request #1121 from greg0ire/void-return
Add void return type declaration to tests
2 parents 0ef972d + bdec456 commit 2178612

26 files changed

+150
-150
lines changed

Tests/BundleTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
class BundleTest extends TestCase
1313
{
14-
public function testBuildCompilerPasses()
14+
public function testBuildCompilerPasses() : void
1515
{
1616
$container = new ContainerBuilder();
1717
$bundle = new DoctrineBundle();

Tests/Command/CreateDatabaseDoctrineTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010

1111
class CreateDatabaseDoctrineTest extends TestCase
1212
{
13-
public function tearDown()
13+
public function tearDown() : void
1414
{
1515
@unlink(sys_get_temp_dir() . '/test');
1616
@unlink(sys_get_temp_dir() . '/shard_1');
1717
@unlink(sys_get_temp_dir() . '/shard_2');
1818
}
1919

20-
public function testExecute()
20+
public function testExecute() : void
2121
{
2222
$connectionName = 'default';
2323
$dbName = 'test';
@@ -41,7 +41,7 @@ public function testExecute()
4141
$this->assertContains('Created database ' . sys_get_temp_dir() . '/' . $dbName . ' for connection named ' . $connectionName, $commandTester->getDisplay());
4242
}
4343

44-
public function testExecuteWithShardOption()
44+
public function testExecuteWithShardOption() : void
4545
{
4646
$connectionName = 'default';
4747
$params = [

Tests/Command/DropDatabaseDoctrineTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
class DropDatabaseDoctrineTest extends TestCase
1212
{
13-
public function testExecute()
13+
public function testExecute() : void
1414
{
1515
$connectionName = 'default';
1616
$dbName = 'test';
@@ -42,7 +42,7 @@ public function testExecute()
4242
);
4343
}
4444

45-
public function testExecuteWithoutOptionForceWillFailWithAttentionMessage()
45+
public function testExecuteWithoutOptionForceWillFailWithAttentionMessage() : void
4646
{
4747
$connectionName = 'default';
4848
$dbName = 'test';

Tests/Command/ImportMappingDoctrineCommandTest.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class ImportMappingDoctrineCommandTest extends TestCase
2525
/** @var CommandTester|null */
2626
private $commandTester;
2727

28-
protected function setup()
28+
protected function setup() : void
2929
{
3030
$this->kernel = new ImportMappingTestingKernel();
3131
$this->kernel->boot();
@@ -40,7 +40,7 @@ protected function setup()
4040
$this->commandTester = new CommandTester($command);
4141
}
4242

43-
protected function tearDown()
43+
protected function tearDown() : void
4444
{
4545
$fs = new Filesystem();
4646
if ($this->kernel !== null) {
@@ -52,7 +52,7 @@ protected function tearDown()
5252
$this->commandTester = null;
5353
}
5454

55-
public function testExecuteXmlWithBundle()
55+
public function testExecuteXmlWithBundle() : void
5656
{
5757
$this->commandTester->execute(['name' => 'ImportMappingTestFooBundle']);
5858

@@ -61,7 +61,7 @@ public function testExecuteXmlWithBundle()
6161
$this->assertContains('"Doctrine\Bundle\DoctrineBundle\Tests\Command\Entity\Product"', file_get_contents($expectedMetadataPath), 'Metadata contains correct namespace');
6262
}
6363

64-
public function testExecuteAnnotationsWithBundle()
64+
public function testExecuteAnnotationsWithBundle() : void
6565
{
6666
$this->commandTester->execute([
6767
'name' => 'ImportMappingTestFooBundle',
@@ -77,12 +77,12 @@ public function testExecuteAnnotationsWithBundle()
7777
* @expectedException \InvalidArgumentException
7878
* @expectedExceptionMessageRegExp /The --path option is required/
7979
*/
80-
public function testExecuteThrowsExceptionWithNamespaceAndNoPath()
80+
public function testExecuteThrowsExceptionWithNamespaceAndNoPath() : void
8181
{
8282
$this->commandTester->execute(['name' => 'Some\Namespace']);
8383
}
8484

85-
public function testExecuteXmlWithNamespace()
85+
public function testExecuteXmlWithNamespace() : void
8686
{
8787
$this->commandTester->execute([
8888
'name' => 'Some\Namespace\Entity',
@@ -94,7 +94,7 @@ public function testExecuteXmlWithNamespace()
9494
$this->assertContains('"Some\Namespace\Entity\Product"', file_get_contents($expectedMetadataPath), 'Metadata contains correct namespace');
9595
}
9696

97-
public function testExecuteAnnotationsWithNamespace()
97+
public function testExecuteAnnotationsWithNamespace() : void
9898
{
9999
$this->commandTester->execute([
100100
'name' => 'Some\Namespace\Entity',
@@ -127,9 +127,9 @@ public function registerBundles() : iterable
127127
];
128128
}
129129

130-
public function registerContainerConfiguration(LoaderInterface $loader)
130+
public function registerContainerConfiguration(LoaderInterface $loader) : void
131131
{
132-
$loader->load(function (ContainerBuilder $container) {
132+
$loader->load(function (ContainerBuilder $container) : void {
133133
$container->loadFromExtension('framework', ['secret' => 'F00']);
134134

135135
$container->loadFromExtension('doctrine', [

Tests/ConnectionFactoryTest.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class ConnectionFactoryTest extends TestCase
1515
/**
1616
* @expectedException \Doctrine\DBAL\DBALException
1717
*/
18-
public function testContainer()
18+
public function testContainer() : void
1919
{
2020
$typesConfig = [];
2121
$factory = new ConnectionFactory($typesConfig);
@@ -38,7 +38,7 @@ public function testContainer()
3838
}
3939
}
4040

41-
public function testDefaultCharset()
41+
public function testDefaultCharset() : void
4242
{
4343
$factory = new ConnectionFactory([]);
4444
$params = [
@@ -54,7 +54,7 @@ public function testDefaultCharset()
5454
$this->assertSame(1 + $creationCount, FakeConnection::$creationCount);
5555
}
5656

57-
public function testDefaultCharsetMySql()
57+
public function testDefaultCharsetMySql() : void
5858
{
5959
$factory = new ConnectionFactory([]);
6060
$params = ['driver' => 'pdo_mysql'];
@@ -106,12 +106,12 @@ public function getDatabasePlatform()
106106
* @param string|null $password
107107
* @param mixed[] $driverOptions
108108
*/
109-
public function connect(array $params, $username = null, $password = null, array $driverOptions = [])
109+
public function connect(array $params, $username = null, $password = null, array $driverOptions = []) : void
110110
{
111111
throw new Exception('not implemented');
112112
}
113113

114-
public function getSchemaManager(Connection $conn)
114+
public function getSchemaManager(Connection $conn) : void
115115
{
116116
throw new Exception('not implemented');
117117
}

Tests/ContainerTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class ContainerTest extends TestCase
2626
*
2727
* @group legacy
2828
*/
29-
public function testContainer()
29+
public function testContainer() : void
3030
{
3131
$container = $this->createXmlBundleTestContainer();
3232

Tests/DataCollector/DoctrineDataCollectorTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class DoctrineDataCollectorTest extends TestCase
1414
const FIRST_ENTITY = 'TestBundle\Test\Entity\Test1';
1515
const SECOND_ENTITY = 'TestBundle\Test\Entity\Test2';
1616

17-
public function testCollectEntities()
17+
public function testCollectEntities() : void
1818
{
1919
$manager = $this->getMockBuilder('Doctrine\ORM\EntityManager')->disableOriginalConstructor()->getMock();
2020
$config = $this->getMockBuilder('Doctrine\ORM\Configuration')->getMock();
@@ -49,7 +49,7 @@ public function testCollectEntities()
4949
$this->assertCount(2, $entities['default']);
5050
}
5151

52-
public function testGetGroupedQueries()
52+
public function testGetGroupedQueries() : void
5353
{
5454
$logger = $this->getMockBuilder('Doctrine\DBAL\Logging\DebugStack')->getMock();
5555
$logger->queries = [];

Tests/Dbal/RegexSchemaAssetFilterTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
class RegexSchemaAssetFilterTest extends TestCase
99
{
10-
public function testShouldIncludeAsset()
10+
public function testShouldIncludeAsset() : void
1111
{
1212
$filter = new RegexSchemaAssetFilter('~^(?!t_)~');
1313

Tests/Dbal/SchemaAssetsFilterManagerTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
class SchemaAssetsFilterManagerTest extends TestCase
1010
{
11-
public function testInvoke()
11+
public function testInvoke() : void
1212
{
1313
$filterA = new RegexSchemaAssetFilter('~^(?!t_)~');
1414
$filterB = new RegexSchemaAssetFilter('~^(?!s_)~');

0 commit comments

Comments
 (0)