Merge branch '3.4' into 4.3

* 3.4:
  Fix mocks for ImmutableEventDispatcher.
This commit is contained in:
Nicolas Grekas 2019-08-23 13:09:44 +02:00
commit 94bd4023eb

View File

@ -40,13 +40,14 @@ class ImmutableEventDispatcherTest extends TestCase
public function testDispatchDelegates() public function testDispatchDelegates()
{ {
$event = new Event(); $event = new Event();
$resultEvent = new Event();
$this->innerDispatcher->expects($this->once()) $this->innerDispatcher->expects($this->once())
->method('dispatch') ->method('dispatch')
->with($event, 'event') ->with($event, 'event')
->willReturn('result'); ->willReturn($resultEvent);
$this->assertSame('result', $this->dispatcher->dispatch($event, 'event')); $this->assertSame($resultEvent, $this->dispatcher->dispatch('event', $event));
} }
public function testGetListenersDelegates() public function testGetListenersDelegates()
@ -54,9 +55,9 @@ class ImmutableEventDispatcherTest extends TestCase
$this->innerDispatcher->expects($this->once()) $this->innerDispatcher->expects($this->once())
->method('getListeners') ->method('getListeners')
->with('event') ->with('event')
->willReturn('result'); ->willReturn(['result']);
$this->assertSame('result', $this->dispatcher->getListeners('event')); $this->assertSame(['result'], $this->dispatcher->getListeners('event'));
} }
public function testHasListenersDelegates() public function testHasListenersDelegates()
@ -64,9 +65,9 @@ class ImmutableEventDispatcherTest extends TestCase
$this->innerDispatcher->expects($this->once()) $this->innerDispatcher->expects($this->once())
->method('hasListeners') ->method('hasListeners')
->with('event') ->with('event')
->willReturn('result'); ->willReturn(true);
$this->assertSame('result', $this->dispatcher->hasListeners('event')); $this->assertTrue($this->dispatcher->hasListeners('event'));
} }
public function testAddListenerDisallowed() public function testAddListenerDisallowed()