Issues (105)

tests/legacy/Route/AbstractRouteTraitTest.php (3 issues)

1
<?php
2
3
namespace Nip\Router\Tests\Legacy\Route;
4
5
use Nip\Router\Route\Route;
6
use Nip\Router\Tests\AbstractTest;
7
8
/**
9
 * Class AbstractRouteTraitTest
10
 * @package Nip\Router\Tests\Legacy\Route
11
 */
12
class AbstractRouteTraitTest extends AbstractTest
13
{
14
    public function testSetParamsNotOverwriteMapDefaults()
15
    {
16
        $route = new Route('/{controller}/{action?index}');
0 ignored issues
show
'/{controller}/{action?index}' of type string is incompatible with the type boolean expected by parameter $map of Nip\Router\Route\Route::__construct(). ( Ignorable by Annotation )

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

16
        $route = new Route(/** @scrutinizer ignore-type */ '/{controller}/{action?index}');
Loading history...
17
        self::assertSame(['action' => 'index'], $route->getDefaults());
18
19
        $params = ['test' => 9];
20
        $route->setParams($params);
0 ignored issues
show
Deprecated Code introduced by
The function Nip\Router\Route\AbstractRoute::setParams() has been deprecated: Use setDefaults ( Ignorable by Annotation )

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

20
        /** @scrutinizer ignore-deprecated */ $route->setParams($params);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
21
        self::assertEquals(['test' => 9, 'action' => 'index'], $route->getDefaults());
22
    }
23
24
    public function testSetParams()
25
    {
26
        $route = new Route();
27
        self::assertSame([], $route->getDefaults());
28
29
        $params = ['test' => 9];
30
        $route->setParams($params);
0 ignored issues
show
Deprecated Code introduced by
The function Nip\Router\Route\AbstractRoute::setParams() has been deprecated: Use setDefaults ( Ignorable by Annotation )

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

30
        /** @scrutinizer ignore-deprecated */ $route->setParams($params);

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
31
        self::assertEquals($params, $route->getDefaults());
32
    }
33
}
34