From 0025331cdbf34b801c2dabfd2f0baca5c889aad0 Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Mon, 18 Jan 2021 12:30:51 +0100 Subject: [PATCH] Fix code style --- .../EnsureProductionSettingsCommandTest.php | 40 ++++++++++++++++--- 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/tests/Doctrine/Tests/ORM/Tools/Console/Command/EnsureProductionSettingsCommandTest.php b/tests/Doctrine/Tests/ORM/Tools/Console/Command/EnsureProductionSettingsCommandTest.php index c3c40de19d5..dd6f8af8e7e 100644 --- a/tests/Doctrine/Tests/ORM/Tools/Console/Command/EnsureProductionSettingsCommandTest.php +++ b/tests/Doctrine/Tests/ORM/Tools/Console/Command/EnsureProductionSettingsCommandTest.php @@ -1,5 +1,7 @@ createMock(EntityManagerInterface::class); @@ -31,14 +36,14 @@ public function testExecute() $this->assertSame(0, $this->executeCommand($em)); } - public function testExecuteFailed() + public function testExecuteFailed(): void { $em = $this->createMock(EntityManagerInterface::class); $configuration = $this->createMock(Configuration::class); $configuration->expects($this->once()) ->method('ensureProductionSettings') - ->willThrowException(new \RuntimeException()); + ->willThrowException(new RuntimeException()); $em->method('getConfiguration') ->willReturn($configuration); @@ -49,7 +54,7 @@ public function testExecuteFailed() $this->assertSame(1, $this->executeCommand($em)); } - public function testExecuteWithComplete() + public function testExecuteWithComplete(): void { $em = $this->createMock(EntityManagerInterface::class); @@ -71,6 +76,29 @@ public function testExecuteWithComplete() $this->assertSame(0, $this->executeCommand($em, ['--complete' => true])); } + public function testExecuteWithCompleteFailed(): void + { + $em = $this->createMock(EntityManagerInterface::class); + + $configuration = $this->createMock(Configuration::class); + $configuration->expects($this->once()) + ->method('ensureProductionSettings'); + + $em->method('getConfiguration') + ->willReturn($configuration); + + $connection = $this->createMock(Connection::class); + + $connection->expects($this->once()) + ->method('connect') + ->willThrowException(new RuntimeException()); + + $em->method('getConnection') + ->willReturn($connection); + + $this->assertSame(1, $this->executeCommand($em, ['--complete' => true])); + } + /** * @param mixed[] $options */ @@ -86,9 +114,9 @@ private function executeCommand( $tester = new CommandTester($command); return $tester->execute( - \array_merge([ + array_merge([ 'command' => $command->getName(), - ], $input), + ], $input) ); } }