Example #1
0
 public function testConstruction()
 {
     $event = new Event('test');
     $this->assertSame('test', $event->getName(), '->__construct() did not set the name of this event');
     // Construction with dispatcher
     $dispatcher = new Dispatcher();
     $event = new Event('test', $dispatcher);
     $this->assertSame($dispatcher, $event->getDispatcher(), '->__construct() did not set the event dispatcher property');
     $this->assertTrue($event->hasDispatcher(), '->hasDispatcher() can not determine if there is an event dispatcher');
     // Notifier only construction
     $event = new Event('test');
     $this->assertInstanceOf('\\SplObjectStorage', $event->getObservers());
     $this->assertFalse($event->hasObservers());
 }