From 97679e5bdab5f2494d6f444d995ae79dd4ccb3ca Mon Sep 17 00:00:00 2001 From: Bulat Shakirzyanov Date: Mon, 7 Feb 2011 20:03:00 -0500 Subject: [PATCH] [DoctrineAbstractBundle] added test for new Loader --- .../Common/DataFixtures/Loader.php | 2 +- .../Tests/Common/ContainerAwareFixture.php | 21 +++++++++++++++++++ .../Tests/Common/DataFixtures/LoaderTest.php | 21 +++++++++++++++++++ .../DoctrineAbstractBundle/Tests/TestCase.php | 13 ++++++++++++ 4 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 src/Symfony/Bundle/DoctrineAbstractBundle/Tests/Common/ContainerAwareFixture.php create mode 100644 src/Symfony/Bundle/DoctrineAbstractBundle/Tests/Common/DataFixtures/LoaderTest.php create mode 100644 src/Symfony/Bundle/DoctrineAbstractBundle/Tests/TestCase.php diff --git a/src/Symfony/Bundle/DoctrineAbstractBundle/Common/DataFixtures/Loader.php b/src/Symfony/Bundle/DoctrineAbstractBundle/Common/DataFixtures/Loader.php index 80d12cc313..1e7c2f754b 100644 --- a/src/Symfony/Bundle/DoctrineAbstractBundle/Common/DataFixtures/Loader.php +++ b/src/Symfony/Bundle/DoctrineAbstractBundle/Common/DataFixtures/Loader.php @@ -19,7 +19,7 @@ class Loader extends BaseLoader public function addFixture(FixtureInterface $fixture) { if ($fixture instanceof ContainerAwareInterface) { - $fixture->setContainer($container); + $fixture->setContainer($this->container); } parent::addFixture($fixture); diff --git a/src/Symfony/Bundle/DoctrineAbstractBundle/Tests/Common/ContainerAwareFixture.php b/src/Symfony/Bundle/DoctrineAbstractBundle/Tests/Common/ContainerAwareFixture.php new file mode 100644 index 0000000000..51a873cd56 --- /dev/null +++ b/src/Symfony/Bundle/DoctrineAbstractBundle/Tests/Common/ContainerAwareFixture.php @@ -0,0 +1,21 @@ +container = $container; + } + + public function load($manager) + { + } +} diff --git a/src/Symfony/Bundle/DoctrineAbstractBundle/Tests/Common/DataFixtures/LoaderTest.php b/src/Symfony/Bundle/DoctrineAbstractBundle/Tests/Common/DataFixtures/LoaderTest.php new file mode 100644 index 0000000000..8bef32a6e2 --- /dev/null +++ b/src/Symfony/Bundle/DoctrineAbstractBundle/Tests/Common/DataFixtures/LoaderTest.php @@ -0,0 +1,21 @@ +getMock('Symfony\Component\DependencyInjection\ContainerInterface'); + $loader = new Loader($container); + $fixture = new ContainerAwareFixture(); + + $loader->addFixture($fixture); + + $this->assertSame($container, $fixture->container); + } +} diff --git a/src/Symfony/Bundle/DoctrineAbstractBundle/Tests/TestCase.php b/src/Symfony/Bundle/DoctrineAbstractBundle/Tests/TestCase.php new file mode 100644 index 0000000000..17326b6d5a --- /dev/null +++ b/src/Symfony/Bundle/DoctrineAbstractBundle/Tests/TestCase.php @@ -0,0 +1,13 @@ +markTestSkipped('Doctrine Data Fixtures is not available.'); + } + } +}