<?php declare(strict_types=1);
namespace Swag\BasicExample\Migration\Test;
use Doctrine\DBAL\Connection;
use PHPUnit\Framework\TestCase;
use Shopware\Core\Framework\Test\TestCaseBase\KernelTestBehaviour;
class Migration1611740369ExampleDescriptionTest extends TestCase
public function testNoChanges(): void
/** @var Connection $conn */
$conn = $this->getContainer()->get(Connection::class);
$expectedSchema = $conn->fetchAssoc('SHOW CREATE TABLE `swag_basic_example_general_settings`')['Create Table'];
$migration = new Migration1611740369ExampleDescription();
$migration->update($conn);
$actualSchema = $conn->fetchAssoc('SHOW CREATE TABLE `swag_basic_example_general_settings`')['Create Table'];
static::assertSame($expectedSchema, $actualSchema, 'Schema changed!. Run init again to have clean state');
$migration->updateDestructive($conn);
$actualSchema = $conn->fetchAssoc('SHOW CREATE TABLE `swag_basic_example_general_settings`')['Create Table'];
static::assertSame($expectedSchema, $actualSchema, 'Schema changed!. Run init again to have clean state');
public function testNoTable(): void
/** @var Connection $conn */
$conn = $this->getContainer()->get(Connection::class);
$conn->executeStatement('DROP TABLE `swag_basic_example_general_settings`');
$migration = new Migration1611740369ExampleDescription();
$migration->update($conn);
$exists = $conn->fetchColumn('SELECT COUNT(*) FROM `swag_basic_example_general_settings`') !== false;
static::assertTrue($exists);