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

orchestral / dusk-updater / 40463596383

27 Oct 2026 06:51AM UTC coverage: 95.313% (-1.5%) from 96.774%
40463596383

push

github

crynobone
Merge branch '2.x' into 3.x

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

1 of 2 new or added lines in 1 file covered. (50.0%)

61 of 64 relevant lines covered (95.31%)

2.7 hits per line

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

90.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
use function Laravel\Prompts\note;
15

16
/**
17
 * @copyright Originally created by Jonas Staudenmeir: https://github.com/staudenmeir/dusk-updater
18
 */
19
#[AsCommand(name: 'update', description: 'Install the ChromeDriver binary')]
20
class UpdateCommand extends Command
21
{
22
    /** {@inheritDoc} */
23
    #[\Override]
24
    protected function configure(): void
25
    {
26
        $this->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
    /**
33
     * {@inheritDoc}
34
     *
35
     * @throws \RuntimeException
36
     */
37
    #[\Override]
38
    protected function execute(InputInterface $input, OutputInterface $output): int
39
    {
40
        if (\is_null($this->directory)) {
3 ✔
41
            throw new RuntimeException('Unable to update ChromeDriver without --install-dir');
×
42
        }
43

44
        $finder = new ChromeVersionFinder;
3 ✔
45

46
        $version = $finder->findVersionUrl($input->getArgument('version'));
3 ✔
47
        $all = $input->getOption('all');
3 ✔
48
        $currentOS = OperatingSystem::id();
3 ✔
49

50
        foreach (OperatingSystem::all() as $operatingSystem) {
3 ✔
51
            if ($all || ($operatingSystem === $currentOS)) {
3 ✔
52
                if ($all && $operatingSystem === 'linux-arm' && version_compare($version, '153.0', '<')) {
3 ✔
NEW
53
                    continue;
×
54
                }
55

56
                $url = $finder->resolveChromeDriverDownloadUrl($version, $operatingSystem);
3 ✔
57
                $archive = (new Actions\DownloadChromeDriver($this->directory, $version))->handle($url);
3 ✔
58
                $binary = (new Actions\PublishChromeDriver($this->directory, $operatingSystem))->handle($archive);
2 ✔
59
            }
60
        }
61

62
        note(\sprintf(
2 ✔
63
            '<info>ChromeDriver %s successfully installed for version %s.</info>', $all ? 'binaries' : 'binary', $version
2 ✔
64
        ));
2 ✔
65

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

© 2026 Coveralls, Inc