Created
March 1, 2019 08:10
-
-
Save enumag/8d5679ed335cf0e2a8c418781bff228c to your computer and use it in GitHub Desktop.
Doctrine schema tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php declare(strict_types = 1); | |
namespace App\Core\Tests\Infrastructure\Doctrine; | |
use App\Library\Test\KernelTestCase; | |
use Symfony\Bundle\FrameworkBundle\Console\Application; | |
use Symfony\Component\Console\Input\ArrayInput; | |
use Symfony\Component\Console\Output\BufferedOutput; | |
final class MigrationsUpToDateTest extends KernelTestCase | |
{ | |
public function testNoMissingMigration(): void | |
{ | |
$this->useEnvironment('test'); | |
$application = new Application($this->getKernel()); | |
$application->setAutoExit(false); | |
$input = new ArrayInput( | |
[ | |
'command' => 'doctrine:schema:update', | |
'--no-interaction' => true, | |
] | |
); | |
$output = new BufferedOutput(); | |
$errorCode = $application->run($input, $output); | |
self::assertSame(0, $errorCode, $output->fetch()); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php declare(strict_types = 1); | |
namespace App\Core\Tests\Infrastructure\Doctrine; | |
use App\Library\Test\KernelTestCase; | |
use Symfony\Bundle\FrameworkBundle\Console\Application; | |
use Symfony\Component\Console\Input\ArrayInput; | |
use Symfony\Component\Console\Output\BufferedOutput; | |
final class ValidSchemaTest extends KernelTestCase | |
{ | |
public function testSchemaIsValid(): void | |
{ | |
$this->useEnvironment('test'); | |
$application = new Application($this->getKernel()); | |
$application->setAutoExit(false); | |
$input = new ArrayInput( | |
[ | |
'command' => 'doctrine:schema:validate', | |
'--no-interaction' => true, | |
] | |
); | |
$output = new BufferedOutput(); | |
$errorCode = $application->run($input, $output); | |
self::assertSame(0, $errorCode, $output->fetch()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment