• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

orchestral / dusk-updater / 13354956518

16 Feb 2025 12:24PM UTC coverage: 59.406% (+13.7%) from 45.745%
13354956518

push

github

web-flow
Use `orchestra/dusk-updater-api` (#15)

* Use `orchestra/dusk-updater-api`

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>

* wip

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>

* wip

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>

* wip

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>

* wip

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>

* wip

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>

* wip

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>

---------

Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>

36 of 40 new or added lines in 5 files covered. (90.0%)

1 existing line in 1 file now uncovered.

60 of 101 relevant lines covered (59.41%)

1.68 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.0
/src/UpdateCommand.php
1
<?php
2

3
namespace Orchestra\DuskUpdater;
4

5
use Orchestra\DuskUpdaterApi\ChromeVersionFinder;
6
use Orchestra\DuskUpdaterApi\OperatingSystem;
7
use RuntimeException;
8
use Symfony\Component\Console\Attribute\AsCommand;
9
use Symfony\Component\Console\Input\InputArgument;
10
use Symfony\Component\Console\Input\InputInterface;
11
use Symfony\Component\Console\Input\InputOption;
12
use Symfony\Component\Console\Output\OutputInterface;
13

14
/**
15
 * @copyright Originally created by Jonas Staudenmeir: https://github.com/staudenmeir/dusk-updater
16
 */
17
#[AsCommand(name: 'update', description: 'Install the ChromeDriver binary.')]
18
class UpdateCommand extends Command
19
{
20
    /** {@inheritDoc */
21
    #[\Override]
22
    protected function configure(): void
23
    {
24
        $this->setName('update')
3✔
25
            ->setDescription('Install the ChromeDriver binary.')
3✔
26
            ->addArgument('version', InputArgument::OPTIONAL)
3✔
27
            ->addOption('all', null, InputOption::VALUE_NONE, 'Install a ChromeDriver binary for every OS');
3✔
28

29
        parent::configure();
3✔
30
    }
31

32
    /** {@inheritDoc */
33
    #[\Override]
34
    protected function execute(InputInterface $input, OutputInterface $output): int
35
    {
36
        if (\is_null($this->directory)) {
3✔
NEW
37
            throw new RuntimeException('Unable to update ChromeDriver without --install-dir');
×
38
        }
39

40
        $finder = new ChromeVersionFinder;
3✔
41

42
        $version = $finder->findVersionUrl($input->getArgument('version'));
3✔
43
        $all = $input->getOption('all');
3✔
44
        $currentOS = OperatingSystem::id();
3✔
45

46
        foreach (OperatingSystem::all() as $operatingSystem) {
3✔
47
            if ($all || ($operatingSystem === $currentOS)) {
3✔
48
                $url = $finder->resolveChromeDriverDownloadUrl($version, $operatingSystem);
3✔
49
                $archive = (new Actions\DownloadChromeDriver($this->directory, $version))->handle($url);
3✔
50
                $binary = (new Actions\PublishChromeDriver($this->directory, $operatingSystem))->handle($archive);
2✔
51
            }
52
        }
53

54
        $output->writeln(\sprintf(
2✔
55
            '<info>ChromeDriver %s successfully installed for version %s.</info>', $all ? 'binaries' : 'binary', $version
2✔
56
        ));
2✔
57

58
        return self::SUCCESS;
2✔
59
    }
60
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc