Passed
Pull Request — master (#156)
by Wilmer
06:05 queued 03:57
created

UrlMatcherInterfaceProxyTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 9
dl 0
loc 14
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testMatch() 0 12 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Debug\Tests\Collector;
6
7
use Nyholm\Psr7\ServerRequest;
8
use PHPUnit\Framework\TestCase;
9
use Yiisoft\Router\FastRoute\UrlMatcher;
10
use Yiisoft\Router\Group;
11
use Yiisoft\Router\Route;
12
use Yiisoft\Router\RouteCollection;
13
use Yiisoft\Router\RouteCollector;
14
use Yiisoft\Yii\Debug\Collector\RouterCollector;
15
use Yiisoft\Yii\Debug\Collector\UrlMatcherInterfaceProxy;
16
17
class UrlMatcherInterfaceProxyTest extends TestCase
18
{
19
    public function testMatch(): void
20
    {
21
        $routeCollector = new RouteCollector();
22
        $routeCollector->addGroup(Group::create()->routes(Route::get('/')));
23
        $matcher = new UrlMatcher(new RouteCollection($routeCollector));
24
        $collector = $this->createMock(RouterCollector::class);
25
        $time = microtime(true);
26
27
        $proxy = new UrlMatcherInterfaceProxy($matcher, $collector);
28
        $collector->expects($this->once())->method('collect')->with($this->equalToWithDelta(microtime(true) - $time, 0.1));
29
30
        $proxy->match(new ServerRequest('GET', '/'));
31
    }
32
}
33