Test Setup Failed
Push — master ( 1d7e99...ecdc34 )
by Gabriel
05:18 queued 10s
created

src/ServiceProvider/Traits/RouterTraitTest.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Nip\Router\Tests\ServiceProvider\Traits;
4
5
use Nip\Container\Container;
6
use Nip\Router\Router;
7
use Nip\Router\RouterServiceProvider;
8
use Nip\Router\Tests\AbstractTest;
9
use Nip\Router\Tests\Fixtures\Application\Library\Router\CustomRouter;
10
11
/**
12
 * Class RouterServiceProviderTest
13
 * @package Nip\Router\Tests\ServiceProvider\Traits
14
 */
15
class RouterTraitTest extends AbstractTest
16
{
17
    public function testRegisterRouter()
18
    {
19
        $container = new Container();
20
        $provider = new RouterServiceProvider();
21
        $provider->setContainer($container);
22
        $provider->registerRouter();
23
24
        self::assertInstanceOf(Router::class, $container->get('router'));
25
    }
26
27
    public function testRegisterCustomRouter()
28
    {
29
        $container = new Container();
30
        $provider = new RouterServiceProvider();
31
        $provider->setContainer($container);
32
        $provider->registerRouter();
33
34
        $container->singleton(Router::class, CustomRouter::class);
0 ignored issues
show
Deprecated Code introduced by
The method Nip\Container\Legacy\Con...thodsTrait::singleton() has been deprecated with message: Use new Share method instead

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

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

Loading history...
35
36
        self::assertInstanceOf(CustomRouter::class, $container->get('router'));
37
    }
38
}
39