DelegatingLoaderTest.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace Symfony\Bundle\FrameworkBundle\Tests\Routing;
  3. use PHPUnit\Framework\TestCase;
  4. use Psr\Log\NullLogger;
  5. use Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser;
  6. use Symfony\Bundle\FrameworkBundle\Routing\DelegatingLoader;
  7. use Symfony\Component\Config\Loader\LoaderResolver;
  8. class DelegatingLoaderTest extends TestCase
  9. {
  10. /** @var ControllerNameParser */
  11. private $controllerNameParser;
  12. protected function setUp()
  13. {
  14. $this->controllerNameParser = $this->getMockBuilder('Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser')
  15. ->disableOriginalConstructor()
  16. ->getMock();
  17. }
  18. /**
  19. * @group legacy
  20. */
  21. public function testLegacyConstructorApi()
  22. {
  23. new DelegatingLoader($this->controllerNameParser, new NullLogger(), new LoaderResolver());
  24. $this->assertTrue(true, '__construct() accepts a LoggerInterface instance as its second argument');
  25. }
  26. /**
  27. * @group legacy
  28. */
  29. public function testLegacyConstructorApiAcceptsNullAsSecondArgument()
  30. {
  31. new DelegatingLoader($this->controllerNameParser, null, new LoaderResolver());
  32. $this->assertTrue(true, '__construct() accepts null as its second argument');
  33. }
  34. public function testConstructorApi()
  35. {
  36. new DelegatingLoader($this->controllerNameParser, new LoaderResolver());
  37. $this->assertTrue(true, '__construct() takes a ControllerNameParser and LoaderResolverInterface respectively as its first and second argument.');
  38. }
  39. }