/**
  * @dataProvider dpParseOptions
  */
 public function testParseOptions(array $arguments, array $expected)
 {
     /** @var \Delusion\Suggestible $input */
     $input = new ArgvInput();
     Configurator::setCustomBehavior($input, 'getOption', $arguments);
     $this->method->invoke(self::$launcher, $input);
     $this->assertSame($expected, $this->params->all());
 }
Beispiel #2
0
 /**
  * Prepare tests.
  */
 protected function setUp()
 {
     $container = new ContainerBuilder();
     /** @var Suggestible $controller */
     $controller = new Controller($container);
     Configurator::setCustomBehavior($controller, 'setRunner', null);
     Configurator::setCustomBehavior($controller, 'switchTo', null);
     Configurator::storeInvokes($controller, true);
     $container->set('controller', $controller);
     /** @var Suggestible $logger */
     $logger = new Logger('test');
     Configurator::setCustomBehavior($logger, 'debug', null);
     Configurator::storeInvokes($logger, true);
     $container->set('logger', $logger);
     $this->runner = new Runner($container);
     $this->controller = $controller;
     $this->logger = $logger;
 }
Beispiel #3
0
 /**
  * Test run suites behavior.
  *
  * @param \ArrayObject $suites
  * @param int $executor
  * @param int $statusCode
  *
  * @dataProvider dpRun
  */
 public function testRun(\ArrayObject $suites, $executor, $statusCode)
 {
     /** @var Suggestible|ContainerBuilder $container */
     $container = new ContainerBuilder();
     /** @var Suggestible $logger */
     $logger = new Logger('test');
     Configurator::setCustomBehavior($logger, 'info', null);
     $container->set('logger', $logger);
     /** @var Suggestible $dispatcher */
     $dispatcher = new EventDispatcher();
     Configurator::storeInvokes($dispatcher, true);
     $container->set('dispatcher', $dispatcher);
     /** @var Suggestible|Processor $processor */
     $processor = new Processor($container);
     Configurator::storeInvokes($processor, true);
     Configurator::setCustomBehavior($processor, 'executor', $executor);
     $this->assertSame($statusCode, $processor->run($suites));
     $this->assertSame([[EventStorage::EV_APP_STARTED], [EventStorage::EV_APP_FINISHED]], Configurator::getInvokes($dispatcher, 'dispatch'), 'Dispatcher did not send application events.');
     $this->assertSame(1, Configurator::getInvokesCount($processor, 'run'));
     $this->assertSame($suites->count(), Configurator::getInvokesCount($processor, 'backupGlobals'));
     $this->assertSame($suites->count(), Configurator::getInvokesCount($processor, 'executor'));
     $this->assertSame($suites->count(), Configurator::getInvokesCount($processor, 'restoreGlobals'));
 }