Exemple #1
0
 /**
  * @covers Libevent\Event\Event::initialize
  * @covers Libevent\Event\Event::generateName
  * @return EventInterface
  */
 public function testEventInit()
 {
     $base = new EventBase();
     // event without direct name
     $event = new Event($base);
     $this->assertTrue(is_string($event->getName()));
     unset($event);
     $event = new Event($base, 'test');
     // Invalid callback test
     try {
         $event->prepare(SIGUSR1, EV_SIGNAL, array($this, 'invalidCallback'), array('test_event'));
         $this->markTestIncomplete('Invalid callback not catched');
     } catch (\InvalidArgumentException $e) {
     }
     $this->assertInstanceOf('Libevent\\Event\\EventInterface', $event->prepare(SIGUSR1, EV_SIGNAL | EV_PERSIST, array($this, 'eventHandlerBreakingLoop'), array('test_event')));
     $this->assertTrue($event->enable());
     return $event;
 }