Class SchemaLoader
Create test database schema from one or more SQL dump files.
This class can be useful to create test database schema when your schema is managed by tools external to your CakePHP application.
It is not well suited for applications/plugins that need to support multiple database platforms. You should use migrations for that instead.
Namespace: Cake\TestSuite\Fixture
Property Summary
-
$helper protected
Cake\TestSuite\ConnectionHelper
Method Summary
-
__construct() public
Constructor.
-
loadInternalFile() public
Load and apply CakePHP-specific schema file.
-
loadSqlFiles() public
Load and apply schema sql file, or an array of files.
Method Detail
loadInternalFile() ¶ public
loadInternalFile(string $file, string $connectionName = 'test'): void
Load and apply CakePHP-specific schema file.
Parameters
-
string
$file Schema file
-
string
$connectionName optional Connection name
Returns
void
loadSqlFiles() ¶ public
loadSqlFiles(array<string>|string $paths, string $connectionName = 'test', bool $dropTables = true, bool $truncateTables = false): void
Load and apply schema sql file, or an array of files.
Parameters
-
array<string>|string
$paths Schema files to load
-
string
$connectionName optional Connection name
-
bool
$dropTables optional Drop all tables prior to loading schema files
-
bool
$truncateTables optional Truncate all tables after loading schema files
Returns
void