1
0
mirror of https://github.com/ToxicCrack/PrintABrick.git synced 2025-05-17 04:40:08 -07:00

Add liip functional test bundle

This commit is contained in:
David Hübner 2017-05-28 19:23:34 +02:00
parent ede71ac9b5
commit 0d7c42dbef
4 changed files with 615 additions and 373 deletions

View File

@ -29,6 +29,9 @@ class AppKernel extends Kernel
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
$bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle();
if ('test' === $this->getEnvironment()) {
$bundles[] = new Liip\FunctionalTestBundle\LiipFunctionalTestBundle();
}
}
return $bundles;

View File

@ -34,7 +34,7 @@
"symfony/phpunit-bridge": "3.3.*@dev",
"phpunit/phpunit": "^6.1",
"friendsofphp/php-cs-fixer": "^2.0",
"mikey179/vfsStream": "^1.6"
"liip/functional-test-bundle": "^1.7",
"doctrine/doctrine-fixtures-bundle": "^2.3"
},
"scripts": {

961
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -2,12 +2,15 @@
namespace Tests\AppBundle\Service;
use AppBundle\DataFixtures\ORM\LoadColors;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Tools\SchemaTool;
use League\Flysystem\FilesystemInterface;
use Liip\FunctionalTestBundle\Test\WebTestCase;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\HttpKernel\KernelInterface;
abstract class BaseTest extends KernelTestCase
abstract class BaseTest extends WebTestCase
{
protected $_container;
@ -20,25 +23,20 @@ abstract class BaseTest extends KernelTestCase
$this->_container = self::$kernel->getContainer();
parent::__construct();
$this->filesystem = $this->get('oneup_flysystem.myfilesystem_filesystem');
$this->filesystem = $this->get('oneup_flysystem.media_filesystem');
}
public function prime(KernelInterface $kernel)
public function setUpDb()
{
// Make sure we are in the test environment
if ('test' !== $kernel->getEnvironment()) {
if ('test' !== self::$kernel->getEnvironment()) {
throw new \LogicException('Primer must be executed in the test environment');
}
// Get the entity manager from the service container
$entityManager = $kernel->getContainer()->get('doctrine.orm.entity_manager');
// Run the schema update tool using our entity metadata
$metadatas = $entityManager->getMetadataFactory()->getAllMetadata();
$schemaTool = new SchemaTool($entityManager);
$schemaTool->updateSchema($metadatas);
// If you are using the Doctrine Fixtures Bundle you could load these here
$this->loadFixtures([
LoadColors::class
]);
}
protected function get($service)