Skip to content

Commit

Permalink
[DoctrineBridge] Add tests for data fixture ContainerAwareLoader
Browse files Browse the repository at this point in the history
  • Loading branch information
jmikola committed Feb 27, 2012
1 parent 3de31c6 commit 48a288e
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
@@ -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);
}
}
@@ -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)
{
}
}

0 comments on commit 48a288e

Please sign in to comment.