Completed
Pull Request — master (#9)
by Simon
01:50
created

RouteSecurityExtensionTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 2
c 1
b 1
f 0
dl 0
loc 12
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testGetFunctions() 0 10 2
1
<?php
2
3
namespace Sil\RouteSecurityBundle\Tests\Twig;
4
5
use PHPUnit\Framework\TestCase;
6
use Sil\RouteSecurityBundle\Security\AccessControl;
7
use Sil\RouteSecurityBundle\Twig\RouteSecurityExtension;
8
9
class RouteSecurityExtensionTest extends TestCase
10
{
11
    public function testGetFunctions()
12
    {
13
        $accessControl = $this->createMock(AccessControl::class);
0 ignored issues
show
Bug introduced by
The method createMock() does not exist on Sil\RouteSecurityBundle\...teSecurityExtensionTest. ( Ignorable by Annotation )

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

13
        $accessControl = $this->/** @scrutinizer ignore-call */ createMock(AccessControl::class);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
14
        $routeSecurityExtension = new RouteSecurityExtension($accessControl);
15
        $twig_functions = $routeSecurityExtension->getFunctions();
16
        $this->assertEquals(3, count($twig_functions));
17
18
        $functions =  ['hasUserAccessToRoute', 'hasUserAccessToRoutes', 'hasUserAccessAtLeastOneRoute'];
19
        foreach ($twig_functions as $index => $twig_function) {
20
            $this->assertTrue(in_array($twig_function->getName(), $functions));
21
        }
22
    }
23
}
24