1 | <?php |
||
2 | |||
3 | /* |
||
4 | * |
||
5 | * (c) Yaroslav Honcharuk <[email protected]> |
||
6 | * |
||
7 | * For the full copyright and license information, please view the LICENSE |
||
8 | * file that was distributed with this source code. |
||
9 | */ |
||
10 | |||
11 | namespace Yarhon\RouteGuardBundle\Tests\Security\TestResolver; |
||
12 | |||
13 | use PHPUnit\Framework\TestCase; |
||
14 | use Symfony\Component\HttpFoundation\Request; |
||
15 | use Symfony\Component\HttpFoundation\RequestStack; |
||
16 | use Yarhon\RouteGuardBundle\Security\Test\SymfonyAccessControlTest; |
||
17 | use Yarhon\RouteGuardBundle\Routing\RouteContext; |
||
18 | use Yarhon\RouteGuardBundle\Security\TestResolver\SymfonyAccessControlResolver; |
||
19 | |||
20 | /** |
||
21 | * @author Yaroslav Honcharuk <[email protected]> |
||
22 | */ |
||
23 | class SymfonyAccessControlResolverTest extends TestCase |
||
24 | { |
||
25 | private $request; |
||
26 | |||
27 | private $resolver; |
||
28 | |||
29 | public function setUp() |
||
30 | { |
||
31 | $requestStack = $this->createMock(RequestStack::class); |
||
32 | $this->request = $this->createMock(Request::class); |
||
33 | |||
34 | $requestStack->method('getCurrentRequest') |
||
0 ignored issues
–
show
|
|||
35 | ->willReturn($this->request); |
||
36 | |||
37 | $this->resolver = new SymfonyAccessControlResolver($requestStack); |
||
38 | } |
||
39 | |||
40 | public function testSupports() |
||
41 | { |
||
42 | $test = new SymfonyAccessControlTest(['ROLE_USER']); |
||
43 | |||
44 | $this->assertTrue($this->resolver->supports($test)); |
||
45 | } |
||
46 | |||
47 | public function testResolve() |
||
48 | { |
||
49 | $test = new SymfonyAccessControlTest(['ROLE_USER']); |
||
50 | |||
51 | $routeContext = new RouteContext('index'); |
||
52 | |||
53 | $resolved = $this->resolver->resolve($test, $routeContext); |
||
54 | |||
55 | $this->assertSame([['ROLE_USER'], $this->request], $resolved); |
||
56 | } |
||
57 | } |
||
58 |
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.