Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[DoctrineBridge] Add tests for data fixture ContainerAwareLoader

  • Loading branch information...
commit 48a288e9dbfce291cf4e0d1bbca0261dd4a5cb1a 1 parent 3de31c6
@jmikola jmikola authored
View
36 tests/Symfony/Tests/Bridge/Doctrine/DataFixtures/ContainerAwareLoaderTest.php
@@ -0,0 +1,36 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Tests\Bridge\Doctrine\DataFixtures;
+
+use Symfony\Bridge\Doctrine\DataFixtures\ContainerAwareLoader;
+use Symfony\Tests\Bridge\Doctrine\Fixtures\ContainerAwareFixture;
+
+class ContainerAwareLoaderTest extends \PHPUnit_Framework_TestCase
+{
+ protected function setUp()
+ {
+ if (!class_exists('Doctrine\Common\DataFixtures\Loader')) {
+ $this->markTestSkipped('Doctrine Data Fixtures is not available.');
+ }
+ }
+
+ public function testShouldSetContainerOnContainerAwareFixture()
+ {
+ $container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
+ $loader = new ContainerAwareLoader($container);
+ $fixture = new ContainerAwareFixture();
+
+ $loader->addFixture($fixture);
+
+ $this->assertSame($container, $fixture->container);
+ }
+}
View
22 tests/Symfony/Tests/Bridge/Doctrine/Fixtures/ContainerAwareFixture.php
@@ -0,0 +1,22 @@
+<?php
+
+namespace Symfony\Tests\Bridge\Doctrine\Fixtures;
+
+use Doctrine\Common\DataFixtures\FixtureInterface;
+use Doctrine\Common\Persistence\ObjectManager;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+use Symfony\Component\DependencyInjection\ContainerAwareInterface;
+
+class ContainerAwareFixture implements FixtureInterface, ContainerAwareInterface
+{
+ public $container;
+
+ public function setContainer(ContainerInterface $container = null)
+ {
+ $this->container = $container;
+ }
+
+ public function load(ObjectManager $manager)
+ {
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.