yarhon /
RouteGuardBundle
| 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\Controller; |
||
| 12 | |||
| 13 | use PHPUnit\Framework\TestCase; |
||
| 14 | use PHPUnit\Framework\MockObject\MockObject; |
||
| 15 | use Symfony\Component\HttpKernel\Kernel; |
||
| 16 | use Symfony\Component\HttpKernel\Bundle\BundleInterface; |
||
| 17 | use Yarhon\RouteGuardBundle\Controller\ControllerNameConverter; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @author Yaroslav Honcharuk <[email protected]> |
||
| 21 | */ |
||
| 22 | class ControllerNameConverterTest extends TestCase |
||
| 23 | { |
||
| 24 | private $converter; |
||
| 25 | |||
| 26 | private $kernel; |
||
| 27 | |||
| 28 | public function setUp() |
||
| 29 | { |
||
| 30 | $this->kernel = $this->createMock(Kernel::class); |
||
| 31 | |||
| 32 | $bundle = $this->createMock(BundleInterface::class); |
||
| 33 | |||
| 34 | $bundle->method('getNamespace') |
||
|
0 ignored issues
–
show
|
|||
| 35 | ->willReturn('Yarhon\RouteGuardBundle\Tests\Fixtures'); |
||
| 36 | |||
| 37 | $this->kernel->method('getBundle') |
||
| 38 | ->willReturn($bundle); |
||
| 39 | |||
| 40 | $this->converter = new ControllerNameConverter($this->kernel); |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @dataProvider convertProvider |
||
| 45 | */ |
||
| 46 | public function testConvert($controller, $expected) |
||
| 47 | { |
||
| 48 | $converted = $this->converter->convert($controller); |
||
| 49 | |||
| 50 | $this->assertEquals($expected, $converted); |
||
| 51 | } |
||
| 52 | |||
| 53 | public function convertProvider() |
||
| 54 | { |
||
| 55 | return [ |
||
| 56 | [ |
||
| 57 | 'service::method', |
||
| 58 | 'service::method', |
||
| 59 | ], |
||
| 60 | [ |
||
| 61 | 'service:method', |
||
| 62 | 'service::method', |
||
| 63 | ], |
||
| 64 | [ |
||
| 65 | 'Bundle:Simple:index', |
||
| 66 | 'Yarhon\RouteGuardBundle\Tests\Fixtures\Controller\SimpleController::indexAction', |
||
| 67 | ], |
||
| 68 | ]; |
||
| 69 | } |
||
| 70 | } |
||
| 71 |
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.