Skip to content

Commit

Permalink
Merge pull request #372 from alexislefebvre/allow-loadFixtures-withou…
Browse files Browse the repository at this point in the history
…t-arguments-310

Allow loadFixtures() without arguments (#310)
  • Loading branch information
alexislefebvre authored Jan 11, 2018
2 parents 182b973 + 4f4eb6c commit 51a625f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,8 @@ Tips for Fixture Loading Tests
```
4. If you don't need any fixtures to be loaded and just want to start off with
an empty database (initialized with your schema), you can simply pass an
empty array to `loadFixtures`.
an empty database (initialized with your schema), you can simply call
`loadFixtures` without any argument.
```php
use Liip\FunctionalTestBundle\Test\WebTestCase;
Expand All @@ -350,7 +350,7 @@ Tips for Fixture Loading Tests
{
public function testIndex()
{
$this->loadFixtures(array());
$this->loadFixtures();
// you can now run your functional tests with a populated database
$client = $this->createClient();
Expand Down
2 changes: 1 addition & 1 deletion src/Test/WebTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ protected function isBackupUpToDate(array $classNames, $backup)
*
* @return null|AbstractExecutor
*/
protected function loadFixtures(array $classNames, $omName = null, $registryName = 'doctrine', $purgeMode = null)
protected function loadFixtures(array $classNames = [], $omName = null, $registryName = 'doctrine', $purgeMode = null)
{
$container = $this->getContainer();
/** @var ManagerRegistry $registry */
Expand Down
10 changes: 10 additions & 0 deletions tests/Test/WebTestCaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,16 @@ public function testLoadEmptyFixtures()
);
}

public function testLoadFixturesWithoutParameters()
{
$fixtures = $this->loadFixtures();

$this->assertInstanceOf(
'Doctrine\Common\DataFixtures\Executor\ORMExecutor',
$fixtures
);
}

public function testLoadFixtures()
{
$fixtures = $this->loadFixtures([
Expand Down

0 comments on commit 51a625f

Please sign in to comment.