bootstrap.php 870 Bytes
Newer Older
1 2 3 4
<?php

declare(strict_types=1);

5 6
use Doctrine\DBAL\DriverManager;

Sergei Morozov's avatar
Sergei Morozov committed
7
(static function () : void {
8 9 10 11 12 13 14 15 16
    // workaround for https://bugs.php.net/bug.php?id=77120
    DriverManager::getConnection([
        'driver' => 'oci8',
        'host' => 'oracle-xe-11',
        'user' => 'ORACLE',
        'password' => 'ORACLE',
        'dbname' => 'XE',
    ])->query('ALTER USER ORACLE IDENTIFIED BY ORACLE');

17 18 19 20 21 22 23 24
    $pos = array_search('--coverage-clover', $_SERVER['argv'], true);

    if ($pos === false) {
        return;
    }

    $file = $_SERVER['argv'][$pos + 1];

Sergei Morozov's avatar
Sergei Morozov committed
25
    register_shutdown_function(static function () use ($file) : void {
26 27 28 29 30 31
        $cmd = 'wget https://github.com/scrutinizer-ci/ocular/releases/download/1.5.2/ocular.phar'
            . ' && php ocular.phar code-coverage:upload --format=php-clover ' . escapeshellarg($file);

        passthru($cmd);
    });
})();