From 4922a6c501df4e4b9516d318b460c64a11c4d7d0 Mon Sep 17 00:00:00 2001 From: Grafikart Date: Mon, 20 Mar 2017 17:05:12 +0100 Subject: [PATCH 1/2] Allow loadFixtures() without arguments (#310) * Allow loading empty fixtures * Added a test for loadFixtures without parameters --- src/Test/WebTestCase.php | 2 +- tests/Test/WebTestCaseTest.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Test/WebTestCase.php b/src/Test/WebTestCase.php index be849c4a..95011f25 100644 --- a/src/Test/WebTestCase.php +++ b/src/Test/WebTestCase.php @@ -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 */ diff --git a/tests/Test/WebTestCaseTest.php b/tests/Test/WebTestCaseTest.php index e6963e72..b3eda813 100644 --- a/tests/Test/WebTestCaseTest.php +++ b/tests/Test/WebTestCaseTest.php @@ -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([ From 4f4eb6c0645c6a3c2f14c8ddcebd5dd862338642 Mon Sep 17 00:00:00 2001 From: Alexis Lefebvre Date: Thu, 11 Jan 2018 20:51:16 +0100 Subject: [PATCH 2/2] README: Explain call of loadFixtures without arguments Signed-off-by: Alexis Lefebvre --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 78cd488b..65ceb9b7 100644 --- a/README.md +++ b/README.md @@ -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; @@ -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();