mirror of
https://github.com/composer/composer
synced 2025-05-09 00:22:53 +00:00
Add ability to call CLI-based commands from an event
This commit is contained in:
parent
62bb5b339b
commit
be90496952
2 changed files with 70 additions and 17 deletions
|
@ -35,6 +35,32 @@ class EventDispatcherTest extends TestCase
|
|||
$dispatcher->dispatchCommandEvent("post-install-cmd");
|
||||
}
|
||||
|
||||
public function testDispatcherCanExecuteCommandLineScripts()
|
||||
{
|
||||
$eventCliCommand = 'phpunit';
|
||||
|
||||
$process = $this->getMock('Composer\Util\ProcessExecutor');
|
||||
$dispatcher = $this->getMockBuilder('Composer\Script\EventDispatcher')
|
||||
->setConstructorArgs(array(
|
||||
$this->getMock('Composer\Composer'),
|
||||
$this->getMock('Composer\IO\IOInterface'),
|
||||
$process,
|
||||
))
|
||||
->setMethods(array('getListeners'))
|
||||
->getMock();
|
||||
|
||||
$listeners = array($eventCliCommand);
|
||||
$dispatcher->expects($this->atLeastOnce())
|
||||
->method('getListeners')
|
||||
->will($this->returnValue($listeners));
|
||||
|
||||
$process->expects($this->once())
|
||||
->method('execute')
|
||||
->with($eventCliCommand);
|
||||
|
||||
$dispatcher->dispatchCommandEvent("post-install-cmd");
|
||||
}
|
||||
|
||||
private function getDispatcherStubForListenersTest($listeners, $io)
|
||||
{
|
||||
$dispatcher = $this->getMockBuilder('Composer\Script\EventDispatcher')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue