Files
piratepoet/tests/_bootstrap.php
Vlad c5f67cb371 - Database cleanup uses Models
- Formatted code as per Marco's comments
2015-08-12 22:48:42 +00:00

25 lines
619 B
PHP

<?php
$console = new \Codeception\Lib\Console\Output([]);
$console->writeln('Loading WP core...');
$wordpress_path = getenv('WP_TEST_PATH');
if ($wordpress_path) {
if (file_exists($wordpress_path . '/wp-load.php')) {
require_once(getenv('WP_TEST_PATH') . '/wp-load.php');
}
} else {
throw new Exception("You need to specify the path to your WordPress installation\n`WP_TEST_PATH` in your .env file");
}
$console->writeln('Cleaning up database...');
$models = array(
"Subscriber",
"Setting"
);
foreach ($models as $model) {
Model::factory("\MailPoet\Models\\" . $model)
->delete_many();
}