Doctrine\Tests\Common\DataFixtures\ORMPurgerExcludeTest::executeTestPurge PHP Метод

executeTestPurge() публичный Метод

Execute test purge
public executeTestPurge ( string | null $expression, array $list )
$expression string | null
$list array
    public function executeTestPurge($expression, array $list)
    {
        $em = $this->loadTestData();
        $excludedRepository = $em->getRepository(self::TEST_ENTITY_EXCLUDED);
        $includedRepository = $em->getRepository(self::TEST_ENTITY_INCLUDED);
        $excluded = $excludedRepository->findAll();
        $included = $includedRepository->findAll();
        $this->assertGreaterThan(0, count($included));
        $this->assertGreaterThan(0, count($excluded));
        $connection = $em->getConnection();
        $configuration = $connection->getConfiguration();
        $configuration->setFilterSchemaAssetsExpression($expression);
        $purger = new ORMPurger($em, $list);
        $purger->purge();
        $excluded = $excludedRepository->findAll();
        $included = $includedRepository->findAll();
        $this->assertEquals(0, count($included));
        $this->assertGreaterThan(0, count($excluded));
    }