whiteletters in blankpapers whiteletters in blankpapers - 11 months ago 41
PHP Question

Why this method get executed without being called?

According to this documentation, I can write a

function in my test class, like:

use Doctrine\ORM\Tools\SchemaTool;
use Liip\FunctionalTestBundle\Test\WebTestCase;

class AccountControllerTest extends WebTestCase
public function setUp()
$em = $this->getContainer()->get('doctrine')->getManager();
if (!isset($metadatas)) {
$metadatas = $em->getMetadataFactory()->getAllMetadata();
$schemaTool = new SchemaTool($em);
if (!empty($metadatas)) {

$fixtures = array(

But when I look for the
method in the extended WebTestCase class, I don't find it. My understanding is that I can redefine a method from parent class in the child class. Parent class is:


Please to explain to me why and when this method get executed? Thank you


setUp() is actually used by PHPUnit, which the Symfony testing framework extends.

Take a look at the PHPUnit documentation for more info: https://phpunit.de/manual/current/en/fixtures.html

Here's a link to the actual abstract class that Symfony is extending: https://github.com/sebastianbergmann/phpunit/blob/master/src/Framework/TestCase.php#L2210