CS fixes
This commit is contained in:
parent
1b4963bd84
commit
4eb003b653
@ -25,7 +25,7 @@ class TraceableEventDispatcherTest extends \PHPUnit_Framework_TestCase
|
|||||||
$dispatcher = new EventDispatcher();
|
$dispatcher = new EventDispatcher();
|
||||||
$tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch());
|
$tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch());
|
||||||
|
|
||||||
$tdispatcher->addListener('foo', $listener = function () { });
|
$tdispatcher->addListener('foo', $listener = function () {});
|
||||||
$listeners = $dispatcher->getListeners('foo');
|
$listeners = $dispatcher->getListeners('foo');
|
||||||
$this->assertCount(1, $listeners);
|
$this->assertCount(1, $listeners);
|
||||||
$this->assertSame($listener, $listeners[0]);
|
$this->assertSame($listener, $listeners[0]);
|
||||||
@ -39,7 +39,7 @@ class TraceableEventDispatcherTest extends \PHPUnit_Framework_TestCase
|
|||||||
$dispatcher = new EventDispatcher();
|
$dispatcher = new EventDispatcher();
|
||||||
$tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch());
|
$tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch());
|
||||||
|
|
||||||
$tdispatcher->addListener('foo', $listener = function () { });
|
$tdispatcher->addListener('foo', $listener = function () {});
|
||||||
$this->assertSame($dispatcher->getListeners('foo'), $tdispatcher->getListeners('foo'));
|
$this->assertSame($dispatcher->getListeners('foo'), $tdispatcher->getListeners('foo'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ class TraceableEventDispatcherTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertFalse($dispatcher->hasListeners('foo'));
|
$this->assertFalse($dispatcher->hasListeners('foo'));
|
||||||
$this->assertFalse($tdispatcher->hasListeners('foo'));
|
$this->assertFalse($tdispatcher->hasListeners('foo'));
|
||||||
|
|
||||||
$tdispatcher->addListener('foo', $listener = function () { });
|
$tdispatcher->addListener('foo', $listener = function () {});
|
||||||
$this->assertTrue($dispatcher->hasListeners('foo'));
|
$this->assertTrue($dispatcher->hasListeners('foo'));
|
||||||
$this->assertTrue($tdispatcher->hasListeners('foo'));
|
$this->assertTrue($tdispatcher->hasListeners('foo'));
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ class TraceableEventDispatcherTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$dispatcher = new EventDispatcher();
|
$dispatcher = new EventDispatcher();
|
||||||
$tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch());
|
$tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch());
|
||||||
$tdispatcher->addListener('foo', $listener = function () { });
|
$tdispatcher->addListener('foo', $listener = function () {});
|
||||||
|
|
||||||
$this->assertEquals(array(), $tdispatcher->getCalledListeners());
|
$this->assertEquals(array(), $tdispatcher->getCalledListeners());
|
||||||
$this->assertEquals(array('foo.closure' => array('event' => 'foo', 'type' => 'Closure', 'pretty' => 'closure')), $tdispatcher->getNotCalledListeners());
|
$this->assertEquals(array('foo.closure' => array('event' => 'foo', 'type' => 'Closure', 'pretty' => 'closure')), $tdispatcher->getNotCalledListeners());
|
||||||
@ -107,8 +107,8 @@ class TraceableEventDispatcherTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$dispatcher = new EventDispatcher();
|
$dispatcher = new EventDispatcher();
|
||||||
$tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch(), $logger);
|
$tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch(), $logger);
|
||||||
$tdispatcher->addListener('foo', $listener1 = function () { });
|
$tdispatcher->addListener('foo', $listener1 = function () {});
|
||||||
$tdispatcher->addListener('foo', $listener2 = function () { });
|
$tdispatcher->addListener('foo', $listener2 = function () {});
|
||||||
|
|
||||||
$logger->expects($this->at(0))->method('debug')->with('Notified event "foo" to listener "closure".');
|
$logger->expects($this->at(0))->method('debug')->with('Notified event "foo" to listener "closure".');
|
||||||
$logger->expects($this->at(1))->method('debug')->with('Notified event "foo" to listener "closure".');
|
$logger->expects($this->at(1))->method('debug')->with('Notified event "foo" to listener "closure".');
|
||||||
@ -123,7 +123,7 @@ class TraceableEventDispatcherTest extends \PHPUnit_Framework_TestCase
|
|||||||
$dispatcher = new EventDispatcher();
|
$dispatcher = new EventDispatcher();
|
||||||
$tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch(), $logger);
|
$tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch(), $logger);
|
||||||
$tdispatcher->addListener('foo', $listener1 = function (Event $event) { $event->stopPropagation(); });
|
$tdispatcher->addListener('foo', $listener1 = function (Event $event) { $event->stopPropagation(); });
|
||||||
$tdispatcher->addListener('foo', $listener2 = function () { });
|
$tdispatcher->addListener('foo', $listener2 = function () {});
|
||||||
|
|
||||||
$logger->expects($this->at(0))->method('debug')->with('Notified event "foo" to listener "closure".');
|
$logger->expects($this->at(0))->method('debug')->with('Notified event "foo" to listener "closure".');
|
||||||
$logger->expects($this->at(1))->method('debug')->with('Listener "closure" stopped propagation of the event "foo".');
|
$logger->expects($this->at(1))->method('debug')->with('Listener "closure" stopped propagation of the event "foo".');
|
||||||
|
Reference in New Issue
Block a user