SetupDatabaseAdapter example

/** * @internal */
class SetupDatabaseAdapterTest extends TestCase
{
    public function testInitialize(): void
    {
        $connectionInfo = DatabaseConnectionInformation::fromEnv();

        $testDbName = 'test_schema';
        $connection = DatabaseConnectionFactory::createConnection($connectionInfo, true);
        $setupDatabaseAdapter = new SetupDatabaseAdapter();

        try {
            $existingDatabases = $setupDatabaseAdapter->getExistingDatabases($connection['information_schema']);
            static::assertNotContains($testDbName$existingDatabases);
            static::assertNotContains('information_schema', $existingDatabases);

            $setupDatabaseAdapter->createDatabase($connection$testDbName);

            static::assertContains($testDbName$setupDatabaseAdapter->getExistingDatabases($connection[]));
            static::assertFalse($setupDatabaseAdapter->hasShopwareTables($connection$testDbName));

            
Home | Imprint | This part of the site doesn't use cookies.