Example #1
0
 /**
  * Test constructor behavior.
  */
 public function testConstructor()
 {
     /** @var Suggestible|ContainerBuilder $container */
     $container = new ContainerBuilder();
     $self = $this;
     Configurator::setCustomBehavior($container, 'get', function ($id) use($self) {
         $self->assertSame('logger', $id);
     });
     Configurator::storeInvokes($container, true);
     new Processor($container);
     $this->assertCount(1, Configurator::getAllInvokes($container));
 }
Example #2
0
 /**
  * Test filter invalid event listeners.
  *
  * @param $annotation
  * @param $event
  *
  * @dataProvider dpRegisterEventListener
  */
 public function testRegisterEventListener($annotation, $event)
 {
     $method = new \ReflectionMethod($this->runner, 'registerEventListener');
     $method->setAccessible(true);
     $method->invoke($this->runner, $annotation, 'precondition');
     $listeners = $this->runner->getPrecondition()->getListeners();
     $this->assertCount(1, Configurator::getAllInvokes($this->logger));
     $this->assertCount(1, $listeners);
     $this->assertArrayHasKey($event, $listeners);
 }