+ public function resetDatabase(Client $client)
+ {
+ $application = new Application($client->getKernel());
+ $application->setAutoExit(false);
+
+ $application->run(new ArrayInput([
+ 'command' => 'doctrine:schema:drop',
+ '--no-interaction' => true,
+ '--force' => true,
+ '--env' => 'test',
+ ]), new NullOutput());
+
+ $application->run(new ArrayInput([
+ 'command' => 'doctrine:schema:create',
+ '--no-interaction' => true,
+ '--env' => 'test',
+ ]), new NullOutput());
+
+ $application->run(new ArrayInput([
+ 'command' => 'doctrine:fixtures:load',
+ '--no-interaction' => true,
+ '--env' => 'test',
+ ]), new NullOutput());
+
+ /*
+ * Recreate client to avoid error:
+ *
+ * [Doctrine\DBAL\ConnectionException]
+ * Transaction commit failed because the transaction has been marked for rollback only.
+ */
+ $this->client = static::createClient();
+ }
+
+ public function getEntityManager()
+ {
+ return $this->client->getContainer()->get('doctrine.orm.entity_manager');
+ }
+