From d79427f1a7b15e8f4d46ce8124a4d0c58ba1479c Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sat, 4 Jul 2015 12:22:58 +0100 Subject: [PATCH] Fix tests --- .../EventDispatcher/EventDispatcherTest.php | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/tests/Composer/Test/EventDispatcher/EventDispatcherTest.php b/tests/Composer/Test/EventDispatcher/EventDispatcherTest.php index 8fc11b98a..e0cb196cb 100644 --- a/tests/Composer/Test/EventDispatcher/EventDispatcherTest.php +++ b/tests/Composer/Test/EventDispatcher/EventDispatcherTest.php @@ -32,10 +32,14 @@ class EventDispatcherTest extends TestCase ), $io); $io->expects($this->at(0)) + ->method('isVerbose') + ->willReturn(0); + + $io->expects($this->at(1)) ->method('writeError') ->with('> Composer\Test\EventDispatcher\EventDispatcherTest::call'); - $io->expects($this->at(1)) + $io->expects($this->at(2)) ->method('writeError') ->with('Script Composer\Test\EventDispatcher\EventDispatcherTest::call handling the post-install-cmd event terminated with an exception'); @@ -119,17 +123,21 @@ class EventDispatcherTest extends TestCase ->method('getListeners') ->will($this->returnValue($listeners)); - $io->expects($this->at(0)) - ->method('writeError') - ->with($this->equalTo('> echo -n foo')); + $io->expects($this->any()) + ->method('isVerbose') + ->willReturn(1); $io->expects($this->at(1)) ->method('writeError') - ->with($this->equalTo('> Composer\Test\EventDispatcher\EventDispatcherTest::someMethod')); + ->with($this->equalTo('> post-install-cmd: echo -n foo')); - $io->expects($this->at(2)) + $io->expects($this->at(3)) ->method('writeError') - ->with($this->equalTo('> echo -n bar')); + ->with($this->equalTo('> post-install-cmd: Composer\Test\EventDispatcher\EventDispatcherTest::someMethod')); + + $io->expects($this->at(5)) + ->method('writeError') + ->with($this->equalTo('> post-install-cmd: echo -n bar')); $dispatcher->dispatchScript(ScriptEvents::POST_INSTALL_CMD, false); } @@ -203,10 +211,14 @@ class EventDispatcherTest extends TestCase ->will($this->returnValue($listener)); $io->expects($this->at(0)) + ->method('isVerbose') + ->willReturn(0); + + $io->expects($this->at(1)) ->method('writeError') ->willReturn('> exit 1'); - $io->expects($this->at(1)) + $io->expects($this->at(2)) ->method('writeError') ->with($this->equalTo('Script '.$code.' handling the post-install-cmd event returned with an error'));