Completed
Branch master (df0330)
by Gabriel
08:50 queued 06:43
created

LiteralTest::tearDown()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Nip\Router\Tests\Parsers;
4
5
use Nip\Router\Parsers\Literal;
6
7
/**
8
 * Test class for Nip_Route_Abstract.
9
 * Generated by PHPUnit on 2010-11-17 at 15:16:44.
10
 */
11
class LiteralTest extends \Nip\Router\Tests\AbstractTest
12
{
13
14
    /**
15
     * @var Literal
16
     */
17
    protected $object;
18
19
    /**
20
     * Sets up the fixture, for example, opens a network connection.
21
     * This method is called before a test is executed.
22
     */
23
    protected function setUp() : void
24
    {
25
        $this->object = new Literal();
26
    }
27
28 View Code Duplication
    public function testAssemble()
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...
29
    {
30
        $params = [
31
            'url' => 'lorem',
32
            'name' => 'ipsum',
33
            'company' => 'dolo&rem',
34
        ];
35
        static::assertEquals('?url=lorem&name=ipsum&company=dolo%26rem', $this->object->assemble($params));
36
37
        $this->object->setMap('shop/cart');
0 ignored issues
show
Documentation introduced by
'shop/cart' is of type string, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
38
        static::assertEquals('shop/cart?url=lorem&name=ipsum&company=dolo%26rem', $this->object->assemble($params));
39
    }
40
41 View Code Duplication
    public function testMatch()
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...
42
    {
43
        $map = 'shop/cart';
44
        $this->object->setMap($map);
0 ignored issues
show
Documentation introduced by
$map is of type string, but the function expects a boolean.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
45
        static::assertFalse($this->object->match('shop/category_cast/'));
46
        static::assertTrue($this->object->match('shop/cart'));
47
    }
48
}
49