Skip to content

Commit

Permalink
Use migrations to build test schema.
Browse files Browse the repository at this point in the history
Replace the SQL dump with migrations based schema generation.
  • Loading branch information
markstory committed Jun 18, 2021
1 parent 127730d commit e1e0c76
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"require": {
"php": ">=7.2",
"cakephp/cakephp": "dev-4.next as 4.3.0",
"cakephp/migrations": "^3.0",
"cakephp/migrations": "dev-3.next as 3.2.0",
"cakephp/plugin-installer": "^1.3",
"mobiledetect/mobiledetectlib": "^2.8"
},
Expand Down
19 changes: 9 additions & 10 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

use Cake\Core\Configure;
use Cake\Datasource\ConnectionManager;
use Migrations\TestSuite\Migrator;

/**
* Test runner bootstrap.
Expand Down Expand Up @@ -51,15 +52,13 @@
// has been written to.
session_id('cli');

// Load schema from a SQL dump file.
// Use migrations to build test database schema.
//
// If your plugin does not use database fixtures you can
// safely delete this.
// Will rebuild the database if the migration state differs
// from the migration history in files.
//
// If you want to support multiple databases, consider
// using migrations to provide schema for your plugin,
// and using \Migrations\TestSuite\Migrator to load schema.
//
// Uncomment these lines to load test database schema from a file.
// use Cake\TestSuite\Schema\SchemaManager;
//SchemaManager::create('test', './tests/schema.sql');
// If you are not using CakePHP's migrations you can
// hook into your migration tool of choice here or
// load schema from a SQL dump file with
// \Cake\TestSuite\Schema\SchemaManager::create('tests', './tests/schema.sql');
Migrator::migrate();

0 comments on commit e1e0c76

Please sign in to comment.