Code Duplication    Length = 37-38 lines in 2 locations

tests/unit/Task/PhpspecTest.php 1 location

@@ 4-41 (lines=38) @@
1
<?php
2
use AspectMock\Test as test;
3
4
class PhpspecTest extends \Codeception\TestCase\Test
5
{
6
    /**
7
     * @var \AspectMock\Proxy\ClassProxy
8
     */
9
    protected $phpspec;
10
11
    protected function _before()
12
    {
13
        $this->phpspec = test::double('Robo\Task\Testing\Phpspec', [
14
            'executeCommand' => null,
15
            'output' => new \Symfony\Component\Console\Output\NullOutput(),
16
            'logger' => new \Psr\Log\NullLogger(),
17
        ]);
18
    }
19
20
    // tests
21
    public function testPhpSpecRun()
22
    {
23
        (new \Robo\Task\Testing\Phpspec('phpspec'))->run();
24
        $this->phpspec->verifyInvoked('executeCommand', ['phpspec run']);
25
    }
26
27
    public function testPHPSpecCommand()
28
    {
29
        $task = (new \Robo\Task\Testing\Phpspec('phpspec'))
30
            ->stopOnFail()
31
            ->noCodeGeneration()
32
            ->quiet()
33
            ->verbose('vv')
34
            ->noAnsi()
35
            ->noInteraction()
36
            ->format('pretty');
37
        verify($task->getCommand())->equals('phpspec run --stop-on-failure --no-code-generation --quiet -vv --no-ansi --no-interaction --format pretty');
38
        $task->run();
39
        $this->phpspec->verifyInvoked('executeCommand', ['phpspec run --stop-on-failure --no-code-generation --quiet -vv --no-ansi --no-interaction --format pretty']);
40
    }
41
}
42

tests/unit/Task/PHPUnitTest.php 1 location

@@ 4-40 (lines=37) @@
1
<?php
2
use AspectMock\Test as test;
3
4
class PHPUnitTest extends \Codeception\TestCase\Test
5
{
6
    /**
7
     * @var \AspectMock\Proxy\ClassProxy
8
     */
9
    protected $phpunit;
10
11
    protected function _before()
12
    {
13
        $this->phpunit = test::double('Robo\Task\Testing\PHPUnit', [
14
            'executeCommand' => null,
15
            'output' => new \Symfony\Component\Console\Output\NullOutput(),
16
            'logger' => new \Psr\Log\NullLogger(),
17
        ]);
18
    }
19
20
    // tests
21
    public function testPhpUnitRun()
22
    {
23
        (new \Robo\Task\Testing\PHPUnit())->run();
24
        $this->phpunit->verifyInvoked('executeCommand');
25
    }
26
27
    public function testPHPUnitCommand()
28
    {
29
        $task = (new \Robo\Task\Testing\PHPUnit('phpunit'))
30
            ->bootstrap('bootstrap.php')
31
            ->filter('Model')
32
            ->group('important')
33
            ->xml('result.xml')
34
            ->debug();
35
        verify($task->getCommand())->equals('phpunit --bootstrap bootstrap.php --filter Model --group important --log-junit result.xml --debug');
36
        $task->run();
37
        $this->phpunit->verifyInvoked('executeCommand', ['phpunit --bootstrap bootstrap.php --filter Model --group important --log-junit result.xml --debug']);
38
    }
39
40
}
41