website-comparison/comparison
Daniel Siepmann 138789a4af
TASK: Refactor code
Do not include output logic into services.
Also do not couple comparison with crawling.

Use Symfony Events to connect features.
2018-09-03 12:40:29 +02:00

35 lines
1 KiB
PHP
Executable file

#!/usr/bin/env php
<?php
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();