LoaderExtensionTest.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /*
  3. * This file is part of the symfony package.
  4. * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
  5. *
  6. * For the full copyright and license information, please view the LICENSE
  7. * file that was distributed with this source code.
  8. */
  9. namespace Symfony\Tests\Components\DependencyInjection\Loader;
  10. require_once __DIR__.'/../../../bootstrap.php';
  11. require_once __DIR__.'/../../../../../fixtures/Symfony/Components/DependencyInjection/includes/ProjectExtension.php';
  12. class LoaderExtensionTest extends \PHPUnit_Framework_TestCase
  13. {
  14. public function testLoad()
  15. {
  16. $extension = new \ProjectExtension();
  17. try
  18. {
  19. $extension->load('foo', array());
  20. $this->fail('->load() throws an InvalidArgumentException if the tag does not exist');
  21. }
  22. catch (\InvalidArgumentException $e)
  23. {
  24. }
  25. $config = $extension->load('bar', array('foo' => 'bar'));
  26. $this->assertEquals(array('project.parameter.bar' => 'bar'), $config->getParameters(), '->load() calls the method tied to the given tag');
  27. }
  28. }