On this page
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.
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
__construct() public
__construct()
Constructor.
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
Property Detail
$helper protected
Type
Cake\TestSuite\ConnectionHelper
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.4/class-Cake.TestSuite.Fixture.SchemaLoader.html