1
0
Fork 0

added php script handler info as well

pull/4123/head
Rob Bast 2015-06-24 09:21:36 +02:00
parent 9223f4a208
commit fd34c5883a
2 changed files with 20 additions and 7 deletions

View File

@ -197,6 +197,8 @@ class EventDispatcher
{ {
$event = $this->checkListenerExpectedEvent(array($className, $methodName), $event); $event = $this->checkListenerExpectedEvent(array($className, $methodName), $event);
$this->io->writeError(sprintf('> %s::%s', $className, $methodName));
return $className::$methodName($event); return $className::$methodName($event);
} }

View File

@ -32,7 +32,11 @@ class EventDispatcherTest extends TestCase
'Composer\Test\EventDispatcher\EventDispatcherTest::call' 'Composer\Test\EventDispatcher\EventDispatcherTest::call'
), $io); ), $io);
$io->expects($this->once()) $io->expects($this->at(0))
->method('writeError')
->with('> Composer\Test\EventDispatcher\EventDispatcherTest::call');
$io->expects($this->at(1))
->method('writeError') ->method('writeError')
->with('<error>Script Composer\Test\EventDispatcher\EventDispatcherTest::call handling the post-install-cmd event terminated with an exception</error>'); ->with('<error>Script Composer\Test\EventDispatcher\EventDispatcherTest::call handling the post-install-cmd event terminated with an exception</error>');
@ -94,12 +98,11 @@ class EventDispatcherTest extends TestCase
$dispatcher = $this->getMockBuilder('Composer\EventDispatcher\EventDispatcher') $dispatcher = $this->getMockBuilder('Composer\EventDispatcher\EventDispatcher')
->setConstructorArgs(array( ->setConstructorArgs(array(
$this->getMock('Composer\Composer'), $this->getMock('Composer\Composer'),
$this->getMock('Composer\IO\IOInterface'), $io = $this->getMock('Composer\IO\IOInterface'),
$process, $process,
)) ))
->setMethods(array( ->setMethods(array(
'getListeners', 'getListeners',
'executeEventPhpScript',
)) ))
->getMock(); ->getMock();
@ -112,14 +115,22 @@ class EventDispatcherTest extends TestCase
'Composer\\Test\\EventDispatcher\\EventDispatcherTest::someMethod', 'Composer\\Test\\EventDispatcher\\EventDispatcherTest::someMethod',
'echo -n bar', 'echo -n bar',
); );
$dispatcher->expects($this->atLeastOnce()) $dispatcher->expects($this->atLeastOnce())
->method('getListeners') ->method('getListeners')
->will($this->returnValue($listeners)); ->will($this->returnValue($listeners));
$dispatcher->expects($this->once()) $io->expects($this->at(0))
->method('executeEventPhpScript') ->method('writeError')
->with('Composer\Test\EventDispatcher\EventDispatcherTest', 'someMethod') ->with($this->equalTo('> echo -n foo'));
->will($this->returnValue(true));
$io->expects($this->at(1))
->method('writeError')
->with($this->equalTo('> Composer\Test\EventDispatcher\EventDispatcherTest::someMethod'));
$io->expects($this->at(2))
->method('writeError')
->with($this->equalTo('> echo -n bar'));
$dispatcher->dispatchScript(ScriptEvents::POST_INSTALL_CMD, false); $dispatcher->dispatchScript(ScriptEvents::POST_INSTALL_CMD, false);
} }