ExecutorDummy::exec()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Polidog\ControllerFilterBundle\Tests\Annotations;
4
5
use Polidog\ControllerFilterBundle\Annotations\Filter;
6
use Polidog\ControllerFilterBundle\Executor;
7
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
8
use Symfony\Component\DependencyInjection\ContainerInterface;
9
use Symfony\Component\HttpKernel\Event\KernelEvent;
10
11
class ExecutorTest extends KernelTestCase
12
{
13
    public function testRun()
14
    {
15
        $container = $this->prophesize(ContainerInterface::class);
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
16
        $kernelEvent = $this->prophesize(KernelEvent::class);
17
        $container->get('executor_dummy')
18
            ->willReturn(new ExecutorDummy());
19
20
        $container->has('executor_dummy')
21
            ->willReturn(true);
22
23
        $e = new Executor($container->reveal());
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $e. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
24
        $filter = new Filter([
25
            'type' => Filter::TYPE_AFTER,
26
            'service' => 'executor_dummy',
27
            'method' => 'exec',
28
        ]);
29
30
        $result = $e->run($filter, $kernelEvent->reveal());
31
        $this->assertSame('call dummy exec method.', $result);
32
33
        $container->get('executor_dummy')->shouldHaveBeenCalled();
34
    }
35
36
}
37
38
class ExecutorDummy
39
{
40
    const MESSAGE = 'call dummy exec method.';
41
42
    public function exec()
43
    {
44
        return self::MESSAGE;
45
    }
46
}
0 ignored issues
show
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
47