liip / liip/LiipFunctionalTestBundle

Force reload of entity metadatas

Open
#262 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature move-to-fixtures-repository
Dominant language
PHP
Stars
648
Forks
179
PR merge metrics
No merged PRs in 30d

Description

I have extended `WebTestCase` and implemented my tests the same as usual. However when running 'all' tests as a batch I came across a problem.

The code I'm testing uses a custom metadata driver. This drivers `getAllClassNames` method will return a subset of the defined entities depending on the bundles configuration. In practice, this works perfectly, in testing it does not. I've tracked the problem down to `WebTestCase::loadFixtures`, which loads the metadatas and stores them in a `private static array`. This means I cannot change which metadatas are loaded once the tests have started.

The easiest fix for this would be to declare `WebTestCase::$cachedMetadatas` as `protected`, that way I can reset it from my derived class.

Can anybody suggest a way around this problem?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading WebTestCase::loadFixtures and the private static cachedMetadatas property to understand when metadata is loaded and reused. Reproduce the issue with a custom metadata driver while running the full test batch, then verify that metadata can be refreshed or reset between differing bundle configurations.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, symfony
Domain
testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.