2018-08-29 10:07:39 +02:00
|
|
|
#!/usr/bin/env php
|
|
|
|
<?php
|
|
|
|
|
|
|
|
require __DIR__ . '/vendor/autoload.php';
|
|
|
|
|
2018-09-03 10:37:23 +02:00
|
|
|
use Codappix\WebsiteComparison\Command\CompareCommand;
|
2018-08-29 10:07:39 +02:00
|
|
|
use Codappix\WebsiteComparison\Command\CreateBaseCommand;
|
2018-09-03 12:40:29 +02:00
|
|
|
use Facebook\WebDriver\Chrome\ChromeDriver;
|
|
|
|
use Facebook\WebDriver\Chrome\ChromeDriverService;
|
2018-08-29 10:07:39 +02:00
|
|
|
use Symfony\Component\Console\Application;
|
2018-09-03 12:40:29 +02:00
|
|
|
use Symfony\Component\EventDispatcher\EventDispatcher;
|
|
|
|
|
|
|
|
$eventDispatcher = new EventDispatcher();
|
|
|
|
|
|
|
|
$chromeDriver = (function () {
|
|
|
|
$chromeDriverService = new ChromeDriverService(
|
|
|
|
'/usr/lib/chromium-browser/chromedriver',
|
|
|
|
9515,
|
|
|
|
[
|
|
|
|
'--port=9515',
|
|
|
|
'--headless',
|
|
|
|
]
|
|
|
|
);
|
|
|
|
|
|
|
|
return ChromeDriver::start(null, $chromeDriverService);
|
|
|
|
})();
|
2018-08-29 10:07:39 +02:00
|
|
|
|
|
|
|
$application = new Application();
|
2018-09-03 12:40:29 +02:00
|
|
|
$application->setDispatcher($eventDispatcher);
|
|
|
|
|
|
|
|
// TODO: Use factory for commands, which injects event dispatcher and chrome driver?
|
|
|
|
$application->add(new CreateBaseCommand($eventDispatcher, $chromeDriver));
|
|
|
|
$application->add(new CompareCommand($eventDispatcher, $chromeDriver));
|
|
|
|
|
2018-08-29 10:07:39 +02:00
|
|
|
$application->run();
|