Skip to content

Commit

Permalink
Add integration tests for --version and --help.
Browse files Browse the repository at this point in the history
Refs #8894
  • Loading branch information
markstory committed May 27, 2016
1 parent 466a027 commit d35a88c
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/TestCase/Console/ShellDispatcherTest.php
Expand Up @@ -341,4 +341,44 @@ public function testShiftArgs()
$this->assertNull($this->dispatcher->shiftArgs());
$this->assertSame([], $this->dispatcher->args);
}

/**
* Test how `bin/cake --help` works.
*
* @return void
*/
public function testHelpOption()
{
$mockShell = $this->getMock('Cake\Shell\CommandListShell', ['main', 'initialize', 'startup']);
$mockShell->expects($this->once())
->method('main');

$dispatcher = $this->getMock('Cake\Console\ShellDispatcher', ['findShell', '_stop']);
$dispatcher->expects($this->once())
->method('findShell')
->with('command_list')
->will($this->returnValue($mockShell));
$dispatcher->args = ['--help'];
$dispatcher->dispatch();
}

/**
* Test how `bin/cake --version` works.
*
* @return void
*/
public function testVersionOption()
{
$mockShell = $this->getMock('Cake\Shell\CommandListShell', ['main', 'initialize', 'startup']);
$mockShell->expects($this->once())
->method('main');

$dispatcher = $this->getMock('Cake\Console\ShellDispatcher', ['findShell', '_stop']);
$dispatcher->expects($this->once())
->method('findShell')
->with('command_list')
->will($this->returnValue($mockShell));
$dispatcher->args = ['--version'];
$dispatcher->dispatch();
}
}

0 comments on commit d35a88c

Please sign in to comment.