Skip to content

Commit

Permalink
Improve test case.
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Feb 25, 2017
1 parent 5e74332 commit 73a9935
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions tests/TestCase/Console/ShellDispatcherTest.php
Expand Up @@ -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);
}

/**
Expand All @@ -248,6 +248,8 @@ public function testDispatchShellWithIntegerSuccessCode()
*/
public function testDispatchShellWithCustomIntegerCodes()
{
$customErrorCode = 3;

$dispatcher = $this->getMockBuilder('Cake\Console\ShellDispatcher')
->setMethods(['findShell'])
->getMock();
Expand All @@ -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')
Expand All @@ -265,7 +267,7 @@ public function testDispatchShellWithCustomIntegerCodes()

$dispatcher->args = ['mock_without_main', 'initdb'];
$result = $dispatcher->dispatch();
$this->assertEquals(3, $result);
$this->assertSame($customErrorCode, $result);
}

/**
Expand All @@ -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);
}

/**
Expand All @@ -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);
}

/**
Expand All @@ -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);
}

/**
Expand All @@ -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);
}

/**
Expand Down

0 comments on commit 73a9935

Please sign in to comment.