Files
piratepoet/tests/_support/Helper/Database.php
Jan Jakeš b39dac75d6 Autofix number of newlines between methods
[MAILPOET-2715]
2020-02-19 19:12:53 +00:00

28 lines
662 B
PHP
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace Helper;
use MailPoet\Config\Env;
use MailPoetVendor\Idiorm\ORM;
// here you can define custom actions
// all public methods declared in helper class will be available in $I
class Database extends \Codeception\Module
{
/**
* Load a SQL file
*
* @param string $filename Filename without extension
*/
static public function loadSQL($filename) {
global $wpdb;
$db = ORM::getDb();
$fullFilename = Env::$path . '/tests/_data/' . $filename . '.sql';
$sql = file_get_contents($fullFilename);
$sql = preg_replace('/`wp_/', '`' . $wpdb->prefix, $sql); // Use the current database prefix
$db->exec($sql);
}
}