From 0b0890f425ced27b2204a046296de4cccdac4eb8 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Sun, 16 Sep 2018 14:08:09 +0200 Subject: Session: Added DatabaseHandler, replaces Symfony PdoSessionHandler --- tests/Unit/HasDatabase.php | 47 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 tests/Unit/HasDatabase.php (limited to 'tests/Unit/HasDatabase.php') diff --git a/tests/Unit/HasDatabase.php b/tests/Unit/HasDatabase.php new file mode 100644 index 00000000..d69f0a3a --- /dev/null +++ b/tests/Unit/HasDatabase.php @@ -0,0 +1,47 @@ +addConnection(['driver' => 'sqlite', 'database' => ':memory:']); + + $connection = $dbManager->getConnection(); + $connection->getPdo()->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + $this->database = new Database($connection); + + $app = new Application(); + $app->instance(Database::class, $this->database); + $app->register(MigrationServiceProvider::class); + + /** @var Migrate $migration */ + $migration = $app->get('db.migration'); + $migration->initMigration(); + + $this->database + ->getConnection() + ->table('migrations') + ->insert([ + ['migration' => '2018_01_01_000001_import_install_sql'], + ['migration' => '2018_01_01_000002_import_update_sql'], + ]); + + $migration->run(__DIR__ . '/../../db/migrations'); + } +} -- cgit v1.2.3-70-g09d2