GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

AbstractTest   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 23
dl 0
loc 53
c 0
b 0
f 0
rs 10
wmc 6

5 Methods

Rating   Name   Duplication   Size   Complexity  
A dep() 0 11 1
A init() 0 10 1
A setUpBeforeClass() 0 4 1
A cleanUp() 0 4 2
A tearDownAfterClass() 0 3 1
1
<?php
2
/* (c) Anton Medvedev <[email protected]>
3
 *
4
 * For the full copyright and license information, please view the LICENSE
5
 * file that was distributed with this source code.
6
 */
7
8
namespace Deployer;
9
10
use PHPUnit\Framework\TestCase;
11
use Symfony\Component\Console\Application;
12
use Symfony\Component\Console\Output\Output;
13
use Symfony\Component\Console\Tester\ApplicationTester;
14
15
/**
16
 * @deprecated Use JoyTest instead.
17
 */
18
abstract class AbstractTest extends TestCase
19
{
20
    /**
21
     * @var ApplicationTester
22
     */
23
    protected $tester;
24
25
    /**
26
     * @var Deployer
27
     */
28
    protected $deployer;
29
30
    public static function setUpBeforeClass(): void
31
    {
32
        self::cleanUp();
33
        mkdir(__TEMP_DIR__);
34
    }
35
36
    public static function tearDownAfterClass(): void
37
    {
38
        self::cleanUp();
39
    }
40
41
    protected static function cleanUp()
42
    {
43
        if (is_dir(__TEMP_DIR__)) {
44
            exec('rm -rf ' . __TEMP_DIR__);
45
        }
46
    }
47
48
    protected function init(string $recipe)
49
    {
50
        $console = new Application();
51
        $console->setAutoExit(false);
52
        $this->tester = new ApplicationTester($console);
53
54
        $this->deployer = new Deployer($console);
55
        $this->deployer->importer->import($recipe);
56
        $this->deployer->init();
57
        $this->deployer->config->set('deploy_path', __TEMP_DIR__ . '/{{hostname}}');
58
    }
59
60
    protected function dep(string $recipe, string $task)
61
    {
62
        $this->init($recipe);
63
        $this->tester->run([
64
            $task,
65
            'selector' => 'all',
66
            '-f' => $recipe,
67
            '-l' => 1,
68
        ], [
69
            'verbosity' => Output::VERBOSITY_VERBOSE,
70
            'interactive' => false,
71
        ]);
72
    }
73
}
74