Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add void return type declaration to tests #1121

Merged
merged 1 commit into from Jan 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Tests/BundleTest.php
Expand Up @@ -11,7 +11,7 @@

class BundleTest extends TestCase
{
public function testBuildCompilerPasses()
public function testBuildCompilerPasses() : void
{
$container = new ContainerBuilder();
$bundle = new DoctrineBundle();
Expand Down
6 changes: 3 additions & 3 deletions Tests/Command/CreateDatabaseDoctrineTest.php
Expand Up @@ -10,14 +10,14 @@

class CreateDatabaseDoctrineTest extends TestCase
{
public function tearDown()
public function tearDown() : void
{
@unlink(sys_get_temp_dir() . '/test');
@unlink(sys_get_temp_dir() . '/shard_1');
@unlink(sys_get_temp_dir() . '/shard_2');
}

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

public function testExecuteWithShardOption()
public function testExecuteWithShardOption() : void
{
$connectionName = 'default';
$params = [
Expand Down
4 changes: 2 additions & 2 deletions Tests/Command/DropDatabaseDoctrineTest.php
Expand Up @@ -10,7 +10,7 @@

class DropDatabaseDoctrineTest extends TestCase
{
public function testExecute()
public function testExecute() : void
{
$connectionName = 'default';
$dbName = 'test';
Expand Down Expand Up @@ -42,7 +42,7 @@ public function testExecute()
);
}

public function testExecuteWithoutOptionForceWillFailWithAttentionMessage()
public function testExecuteWithoutOptionForceWillFailWithAttentionMessage() : void
{
$connectionName = 'default';
$dbName = 'test';
Expand Down
18 changes: 9 additions & 9 deletions Tests/Command/ImportMappingDoctrineCommandTest.php
Expand Up @@ -25,7 +25,7 @@ class ImportMappingDoctrineCommandTest extends TestCase
/** @var CommandTester|null */
private $commandTester;

protected function setup()
protected function setup() : void
{
$this->kernel = new ImportMappingTestingKernel();
$this->kernel->boot();
Expand All @@ -40,7 +40,7 @@ protected function setup()
$this->commandTester = new CommandTester($command);
}

protected function tearDown()
protected function tearDown() : void
{
$fs = new Filesystem();
if ($this->kernel !== null) {
Expand All @@ -52,7 +52,7 @@ protected function tearDown()
$this->commandTester = null;
}

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

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

public function testExecuteAnnotationsWithBundle()
public function testExecuteAnnotationsWithBundle() : void
{
$this->commandTester->execute([
'name' => 'ImportMappingTestFooBundle',
Expand All @@ -77,12 +77,12 @@ public function testExecuteAnnotationsWithBundle()
* @expectedException \InvalidArgumentException
* @expectedExceptionMessageRegExp /The --path option is required/
*/
public function testExecuteThrowsExceptionWithNamespaceAndNoPath()
public function testExecuteThrowsExceptionWithNamespaceAndNoPath() : void
{
$this->commandTester->execute(['name' => 'Some\Namespace']);
}

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

public function testExecuteAnnotationsWithNamespace()
public function testExecuteAnnotationsWithNamespace() : void
{
$this->commandTester->execute([
'name' => 'Some\Namespace\Entity',
Expand Down Expand Up @@ -127,9 +127,9 @@ public function registerBundles() : iterable
];
}

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

$container->loadFromExtension('doctrine', [
Expand Down
10 changes: 5 additions & 5 deletions Tests/ConnectionFactoryTest.php
Expand Up @@ -15,7 +15,7 @@ class ConnectionFactoryTest extends TestCase
/**
* @expectedException \Doctrine\DBAL\DBALException
*/
public function testContainer()
public function testContainer() : void
{
$typesConfig = [];
$factory = new ConnectionFactory($typesConfig);
Expand All @@ -38,7 +38,7 @@ public function testContainer()
}
}

public function testDefaultCharset()
public function testDefaultCharset() : void
{
$factory = new ConnectionFactory([]);
$params = [
Expand All @@ -54,7 +54,7 @@ public function testDefaultCharset()
$this->assertSame(1 + $creationCount, FakeConnection::$creationCount);
}

public function testDefaultCharsetMySql()
public function testDefaultCharsetMySql() : void
{
$factory = new ConnectionFactory([]);
$params = ['driver' => 'pdo_mysql'];
Expand Down Expand Up @@ -106,12 +106,12 @@ public function getDatabasePlatform()
* @param string|null $password
* @param mixed[] $driverOptions
*/
public function connect(array $params, $username = null, $password = null, array $driverOptions = [])
public function connect(array $params, $username = null, $password = null, array $driverOptions = []) : void
{
throw new Exception('not implemented');
}

public function getSchemaManager(Connection $conn)
public function getSchemaManager(Connection $conn) : void
{
throw new Exception('not implemented');
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/ContainerTest.php
Expand Up @@ -26,7 +26,7 @@ class ContainerTest extends TestCase
*
* @group legacy
*/
public function testContainer()
public function testContainer() : void
{
$container = $this->createXmlBundleTestContainer();

Expand Down
4 changes: 2 additions & 2 deletions Tests/DataCollector/DoctrineDataCollectorTest.php
Expand Up @@ -14,7 +14,7 @@ class DoctrineDataCollectorTest extends TestCase
const FIRST_ENTITY = 'TestBundle\Test\Entity\Test1';
const SECOND_ENTITY = 'TestBundle\Test\Entity\Test2';

public function testCollectEntities()
public function testCollectEntities() : void
{
$manager = $this->getMockBuilder('Doctrine\ORM\EntityManager')->disableOriginalConstructor()->getMock();
$config = $this->getMockBuilder('Doctrine\ORM\Configuration')->getMock();
Expand Down Expand Up @@ -49,7 +49,7 @@ public function testCollectEntities()
$this->assertCount(2, $entities['default']);
}

public function testGetGroupedQueries()
public function testGetGroupedQueries() : void
{
$logger = $this->getMockBuilder('Doctrine\DBAL\Logging\DebugStack')->getMock();
$logger->queries = [];
Expand Down
2 changes: 1 addition & 1 deletion Tests/Dbal/RegexSchemaAssetFilterTest.php
Expand Up @@ -7,7 +7,7 @@

class RegexSchemaAssetFilterTest extends TestCase
{
public function testShouldIncludeAsset()
public function testShouldIncludeAsset() : void
{
$filter = new RegexSchemaAssetFilter('~^(?!t_)~');

Expand Down
2 changes: 1 addition & 1 deletion Tests/Dbal/SchemaAssetsFilterManagerTest.php
Expand Up @@ -8,7 +8,7 @@

class SchemaAssetsFilterManagerTest extends TestCase
{
public function testInvoke()
public function testInvoke() : void
{
$filterA = new RegexSchemaAssetFilter('~^(?!t_)~');
$filterB = new RegexSchemaAssetFilter('~^(?!s_)~');
Expand Down