Completed
Pull Request — master (#16)
by Nikola
01:29
created

DebugAdvisorCommandTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 7
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 7
loc 7
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
/**
3
 * Go! AOP framework
4
 *
5
 * @copyright Copyright 2015, Lisachenko Alexander <[email protected]>
6
 *
7
 * This source file is subject to the license that is bundled
8
 * with this source code in the file LICENSE.
9
 */
10
11
namespace Go\Symfony\GoAopBundle\Tests\Command;
12
13
use PHPUnit\Framework\TestCase;
14
use Symfony\Component\Process\Process;
15
16
class DebugAdvisorCommandTest extends TestCase
17
{
18 View Code Duplication
    public function setUp()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
19
    {
20
        $process = new Process(sprintf('php %s cache:warmup:aop', realpath(__DIR__.'/../Fixtures/project/bin/console')));
21
        $process->run();
22
23
        $this->assertTrue($process->isSuccessful(), 'Unable to execute "cache:warmup:aop" command.');
24
    }
25
26
    /**
27
     * @test
28
     * @runInSeparateProcess
29
     */
30 View Code Duplication
    public function itDisplaysAdvisorsDebugInfo()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
31
    {
32
        $process = new Process(sprintf('php %s debug:advisor', realpath(__DIR__.'/../Fixtures/project/bin/console')));
33
        $process->run();
34
35
        $this->assertTrue($process->isSuccessful(), 'Unable to execute "debug:advisor" command.');
36
37
        $output = $process->getOutput();
38
39
        $expected = [
40
            'List of registered advisors in the container',
41
            'Go\Symfony\GoAopBundle\Tests\TestProject\Aspect\LoggingAspect->beforeMethod',
42
            '@execution(Go\Symfony\GoAopBundle\Tests\TestProject\Annotation\Loggable)',
43
        ];
44
45
        foreach ($expected as $string) {
46
            $this->assertContains($string, $output);
47
        }
48
    }
49
50
    /**
51
     * @test
52
     * @runInSeparateProcess
53
     */
54 View Code Duplication
    public function itDisplaysStatedAdvisorDebugInfo()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
55
    {
56
        $process = new Process(sprintf('php %s debug:advisor --advisor="Go\Symfony\GoAopBundle\Tests\TestProject\Aspect\LoggingAspect->beforeMethod"', realpath(__DIR__.'/../Fixtures/project/bin/console')));
57
        $process->run();
58
59
        $this->assertTrue($process->isSuccessful(), 'Unable to execute "debug:advisor" command.');
60
61
        $output = $process->getOutput();
62
63
        $expected = [
64
            'Total 3 files to analyze.',
65
            '-> matching method Go\Symfony\GoAopBundle\Tests\TestProject\Application\Main->doSomething',
66
        ];
67
68
        foreach ($expected as $string) {
69
            $this->assertContains($string, $output);
70
        }
71
    }
72
}
73