PhpFrameworkExtensionTest.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection;
  11. use Symfony\Component\Config\FileLocator;
  12. use Symfony\Component\DependencyInjection\ContainerBuilder;
  13. use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
  14. class PhpFrameworkExtensionTest extends FrameworkExtensionTest
  15. {
  16. protected function loadFromFile(ContainerBuilder $container, $file)
  17. {
  18. $loader = new PhpFileLoader($container, new FileLocator(__DIR__.'/Fixtures/php'));
  19. $loader->load($file.'.php');
  20. }
  21. /**
  22. * @expectedException \LogicException
  23. */
  24. public function testAssetsCannotHavePathAndUrl()
  25. {
  26. $this->createContainerFromClosure(function ($container) {
  27. $container->loadFromExtension('framework', array(
  28. 'assets' => array(
  29. 'base_urls' => 'http://cdn.example.com',
  30. 'base_path' => '/foo',
  31. ),
  32. ));
  33. });
  34. }
  35. /**
  36. * @expectedException \LogicException
  37. */
  38. public function testAssetPackageCannotHavePathAndUrl()
  39. {
  40. $this->createContainerFromClosure(function ($container) {
  41. $container->loadFromExtension('framework', array(
  42. 'assets' => array(
  43. 'packages' => array(
  44. 'impossible' => array(
  45. 'base_urls' => 'http://cdn.example.com',
  46. 'base_path' => '/foo',
  47. ),
  48. ),
  49. ),
  50. ));
  51. });
  52. }
  53. }