#!/usr/bin/env php
<?php
/**
 * Minimal command line entry point to the minimal Test Symfony Application
 *
 * Copyright (c) 2016 Afrihost Internet Services (Pty) Ltd
 * For the full copyright and license information, please view the LICENSE file that was distributed with this source code.
 */

use Afrihost\BaseCommandBundle\EventListener\BaseOptionsEvent;
use Afrihost\BaseCommandBundle\Tests\Fixtures\App\TestKernel;
use Doctrine\Common\Annotations\AnnotationRegistry;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\ConsoleEvents;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;

set_time_limit(30);

$loader = require('../../../vendor/autoload.php');
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
Debug::enable();

$input = new ArgvInput();
$kernel = new TestKernel('test', true);
$kernel->boot();

$dispatcher = $kernel->getContainer()->get('event_dispatcher');
$dispatcher->addListener(ConsoleEvents::COMMAND, array(new BaseOptionsEvent(), 'onConsoleCommand'));

$application = new Application($kernel);

$application->add(new \Afrihost\BaseCommandBundle\Tests\Fixtures\LockCommand());
$application->add(new \Afrihost\BaseCommandBundle\Tests\Fixtures\IconCommand());

$application->run($input);
