From 73a9935f2073b2218a5f5c1a7d7b4646b8f76970 Mon Sep 17 00:00:00 2001 From: dereuromark Date: Sat, 25 Feb 2017 17:08:19 +0100 Subject: [PATCH] Improve test case. --- tests/TestCase/Console/ShellDispatcherTest.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tests/TestCase/Console/ShellDispatcherTest.php b/tests/TestCase/Console/ShellDispatcherTest.php index 5f0104f7be4..d4f659744a6 100644 --- a/tests/TestCase/Console/ShellDispatcherTest.php +++ b/tests/TestCase/Console/ShellDispatcherTest.php @@ -238,7 +238,7 @@ public function testDispatchShellWithIntegerSuccessCode() $dispatcher->args = ['mock_without_main', 'initdb']; $result = $dispatcher->dispatch(); - $this->assertEquals(Shell::CODE_SUCCESS, $result); + $this->assertSame(Shell::CODE_SUCCESS, $result); } /** @@ -248,6 +248,8 @@ public function testDispatchShellWithIntegerSuccessCode() */ public function testDispatchShellWithCustomIntegerCodes() { + $customErrorCode = 3; + $dispatcher = $this->getMockBuilder('Cake\Console\ShellDispatcher') ->setMethods(['findShell']) ->getMock(); @@ -256,7 +258,7 @@ public function testDispatchShellWithCustomIntegerCodes() $Shell->expects($this->once())->method('initialize'); $Shell->expects($this->once())->method('runCommand') ->with(['initdb']) - ->will($this->returnValue(3)); + ->will($this->returnValue($customErrorCode)); $dispatcher->expects($this->any()) ->method('findShell') @@ -265,7 +267,7 @@ public function testDispatchShellWithCustomIntegerCodes() $dispatcher->args = ['mock_without_main', 'initdb']; $result = $dispatcher->dispatch(); - $this->assertEquals(3, $result); + $this->assertSame($customErrorCode, $result); } /** @@ -292,7 +294,7 @@ public function testDispatchShellWithoutMain() $dispatcher->args = ['mock_without_main', 'initdb']; $result = $dispatcher->dispatch(); - $this->assertEquals(Shell::CODE_SUCCESS, $result); + $this->assertSame(Shell::CODE_SUCCESS, $result); } /** @@ -319,7 +321,7 @@ public function testDispatchShortPluginAlias() $dispatcher->args = ['example']; $result = $dispatcher->dispatch(); - $this->assertEquals(Shell::CODE_SUCCESS, $result); + $this->assertSame(Shell::CODE_SUCCESS, $result); } /** @@ -346,7 +348,7 @@ public function testDispatchShortPluginAliasCamelized() $dispatcher->args = ['Example']; $result = $dispatcher->dispatch(); - $this->assertEquals(Shell::CODE_SUCCESS, $result); + $this->assertSame(Shell::CODE_SUCCESS, $result); } /** @@ -373,7 +375,7 @@ public function testDispatchShortPluginAliasConflict() $dispatcher->args = ['sample']; $result = $dispatcher->dispatch(); - $this->assertEquals(Shell::CODE_SUCCESS, $result); + $this->assertSame(Shell::CODE_SUCCESS, $result); } /**