Passed
Push — master ( a3f40e...f6b1e4 )
by Jean-Bernard
01:40
created

NullStringControllerModelTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 26
c 0
b 0
f 0
wmc 2
lcom 0
cbo 2
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testCanBeCreated() 0 8 1
A testReturnsResponseParameters() 0 14 1
1
<?php
2
3
/*
4
 * This file is part of the Symfony-Util package.
5
 *
6
 * (c) Jean-Bernard Addor
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
use PHPUnit\Framework\TestCase;
13
use Symfony\Component\HttpFoundation\Request;
14
use SymfonyUtil\Component\HttpFoundation\NullStringControllerModel;
15
16
/**
17
 * @covers \SymfonyUtil\Component\HttpFoundation\NullStringControllerModel
18
 */
19
final class NullStringControllerModelTest extends TestCase
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
20
{
21
    public function testCanBeCreated()
22
    {
23
        $this->assertInstanceOf(
24
            // ::class, // 5.4 < php
25
            'SymfonyUtil\Component\HttpFoundation\NullStringControllerModel',
26
            new NullStringControllerModel('')
0 ignored issues
show
Unused Code introduced by
The call to NullStringControllerModel::__construct() has too many arguments starting with ''.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
27
        );
28
    }
29
30
    public function testReturnsResponseParameters()
31
    {
32
        $this->assertInstanceOf(
33
            // ::class, // 5.4 < php
34
            'SymfonyUtil\Component\HttpFoundation\ResponseParameters',
35
            (new NullStringControllerModel())->__invoke('', new Request())
36
        );
37
        /*
0 ignored issues
show
Unused Code Comprehensibility introduced by
70% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
38
        $this->assertInternalType('array', (new NullStringControllerModel())->__invoke('', new Request()));
39
        $this->assertSame([], (new NullStringControllerModel())->__invoke('', new Request()));
40
        $this->assertSame(0, count((new NullStringControllerModel())->__invoke('', new Request())));
41
        $this->assertEmpty((new NullStringControllerModel())->__invoke('', new Request()));
42
        */
43
    }
44
}
45