website-comparison/comparison

43 lines
1.1 KiB
PHP
Executable file

#!/usr/bin/env php
<?php
declare(ticks = 1);
pcntl_signal(SIGINT, function () {
exit(99);
});
require __DIR__ . '/vendor/autoload.php';
use Codappix\WebsiteComparison\Command\CompareCommand;
use Codappix\WebsiteComparison\Command\CreateBaseCommand;
use Facebook\WebDriver\Chrome\ChromeDriver;
use Facebook\WebDriver\Chrome\ChromeDriverService;
use Symfony\Component\Console\Application;
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);
})();
$application = new Application();
$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));
$application->run();