liip / liip/LiipFunctionalTestBundle
WebTestCase::loadFixtureFiles with append=false using ODM fails
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 648
- Forks
- 179
- PR merge metrics
- No merged PRs in 30d
Description
When attempting to use `\Liip\FunctionalTestBundle\Test\WebTestCase::loadFixtureFiles()` passing in `append=false`, I encountered an error. I believe it has to do with detection of the DB platform as shown in [L382-L394](https://github.com/liip/LiipFunctionalTestBundle/blob/master/Test/WebTestCase.php#L382-L394).
My workaround, presently, is as follows:
``` php
/**
* @inheritDoc
*/
public function loadFixtureFiles(array $paths = [], $append = false, $omName = null, $registryName = 'doctrine')
{
$om = $this->getObjectManager($omName, $registryName);
if ($append == false && ($om instanceof DocumentManager)) {
$sm = $om->getSchemaManager();
$sm->dropDatabases();
$sm->createDatabases();
}
parent::loadFixtureFiles($paths, true, $omName, $registryName);
}
```
Not sure if that would be the ideal approach, or if there's a better platform agnostic way of determining which class methods need to be called for a reset. Just wanted to call it out for a future release!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at Test/WebTestCase.php lines 382-394 and trace loadFixtureFiles() when append=false with an ODM DocumentManager. Compare the reported workaround with the existing database-platform detection and determine the platform-agnostic reset path. Done means the method no longer fails for ODM usage with append=false; no test file is named in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, symfony
- Domain
- database, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100