Skip to content

Commit ac44536

Browse files
Merge pull request #36 from tPl0ch/feature/purge-mode
Add constant to be able to change purge mode for fixtures.
2 parents c382ae6 + a17acdb commit ac44536

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

Test/Functional/WebTestCase.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace IC\Bundle\Base\TestBundle\Test\Functional;
77

88
use Doctrine\Common\Collections\ArrayCollection;
9+
use Doctrine\Common\DataFixtures\Purger\ORMPurger;
910
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase as BaseWebTestCase;
1011
use IC\Bundle\Base\TestBundle\Test\Loader;
1112

@@ -24,6 +25,8 @@ abstract class WebTestCase extends BaseWebTestCase
2425

2526
const MANAGER_NAME = null;
2627

28+
const FIXTURES_PURGE_MODE = ORMPurger::PURGE_MODE_DELETE;
29+
2730
/**
2831
* @var boolean
2932
*/
@@ -56,7 +59,7 @@ protected function setUp()
5659
return;
5760
}
5861

59-
$fixtureLoader = new Loader\FixtureLoader($this->client);
62+
$fixtureLoader = new Loader\FixtureLoader($this->client, static::FIXTURES_PURGE_MODE);
6063
$executor = $fixtureLoader->load(static::MANAGER_NAME, $fixtureList);
6164

6265
$this->referenceRepository = $executor->getReferenceRepository();

Test/Loader/FixtureLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ class FixtureLoader
4040
*
4141
* @param \Symfony\Bundle\FrameworkBundle\Client $client
4242
*/
43-
public function __construct(Client $client)
43+
public function __construct(Client $client, $purgeMode = ORMPurger::PURGE_MODE_DELETE)
4444
{
4545
$this->client = $client;
46-
$this->purgeMode = ORMPurger::PURGE_MODE_DELETE;
46+
$this->purgeMode = $purgeMode;
4747
}
4848

4949
/**

0 commit comments

Comments
 (0)