Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DoctrineBridge] Add tests for data fixture ContainerAwareLoader
- Loading branch information
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
tests/Symfony/Tests/Bridge/Doctrine/DataFixtures/ContainerAwareLoaderTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
tests/Symfony/Tests/Bridge/Doctrine/Fixtures/ContainerAwareFixture.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
{ | ||
} | ||
} |