Issues (105)

tests/src/Parsers/LiteralTest.php (2 issues)

Labels
Severity
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
    public function testAssemble()
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
'shop/cart' of type string is incompatible with the type boolean expected by parameter $map of Nip\Router\Parsers\AbstractParser::setMap(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

37
        $this->object->setMap(/** @scrutinizer ignore-type */ 'shop/cart');
Loading history...
38
        static::assertEquals('shop/cart?url=lorem&name=ipsum&company=dolo%26rem', $this->object->assemble($params));
39
    }
40
41
    public function testMatch()
42
    {
43
        $map = 'shop/cart';
44
        $this->object->setMap($map);
0 ignored issues
show
$map of type string is incompatible with the type boolean expected by parameter $map of Nip\Router\Parsers\AbstractParser::setMap(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

44
        $this->object->setMap(/** @scrutinizer ignore-type */ $map);
Loading history...
45
        static::assertFalse($this->object->match('shop/category_cast/'));
46
        static::assertTrue($this->object->match('shop/cart'));
47
    }
48
}
49