ContainerAwareLoaderTest.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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\Bridge\Doctrine\Tests\DataFixtures;
  11. use Symfony\Bridge\Doctrine\DataFixtures\ContainerAwareLoader;
  12. use Symfony\Bridge\Doctrine\Tests\Fixtures\ContainerAwareFixture;
  13. class ContainerAwareLoaderTest extends \PHPUnit_Framework_TestCase
  14. {
  15. protected function setUp()
  16. {
  17. if (!class_exists('Symfony\Component\DependencyInjection\Container')) {
  18. $this->markTestSkipped('The "DependencyInjection" component is not available');
  19. }
  20. if (!class_exists('Doctrine\Common\DataFixtures\Loader')) {
  21. $this->markTestSkipped('Doctrine Data Fixtures is not available.');
  22. }
  23. }
  24. public function testShouldSetContainerOnContainerAwareFixture()
  25. {
  26. $container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
  27. $loader = new ContainerAwareLoader($container);
  28. $fixture = new ContainerAwareFixture();
  29. $loader->addFixture($fixture);
  30. $this->assertSame($container, $fixture->container);
  31. }
  32. }