Dumplie\Metadata\Tests\Integration\Infrastructure\Doctrine\Dbal\DoctrineStorageTest::setUp PHP Method

setUp() public method

public setUp ( )
    public function setUp()
    {
        $this->connection = DriverManager::getConnection(json_decode(DUMPLIE_TEST_DB_CONNECTION, true));
        if ($this->connection->getSchemaManager()->tablesExist('metadata_test_bar')) {
            $this->connection->getSchemaManager()->dropTable('metadata_test_bar');
        }
        if ($this->connection->getSchemaManager()->tablesExist('metadata_test_foo')) {
            $this->connection->getSchemaManager()->dropTable('metadata_test_foo');
        }
        $foo = new TypeSchema('foo', ['id' => new TextField(), 'text' => new TextField(null, false, ['index' => true])]);
        $bar = new TypeSchema('bar', ['id' => new TextField(), 'link' => new AssociationField('test', $foo)]);
        $this->schema = new Schema('test');
        $this->schema->add($foo);
        $this->schema->add($bar);
        $this->storage = new DoctrineStorage($this->connection, TypeRegistry::withDefaultTypes());
    }