public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
self::$testConfig = TestConfig::createDefaultConfig();
self::$wpAutomation = new WpAutomation(self::$testConfig->testSite, self::$testConfig->wpCliVersion);
self::setUpSite();
DBAsserter::assertFilesEqualDatabase();
$yamlDir = self::$wpAutomation->getPluginsDir() . '/versionpress/.versionpress';
$schemaFile = $yamlDir . '/schema.yml';
$actionsFile = $yamlDir . '/actions.yml';
$shortcodeFile = $yamlDir . '/shortcodes.yml';
/** @var $wp_db_version */
require self::$wpAutomation->getAbspath() . '/wp-includes/version.php';
if (!function_exists('get_shortcode_regex')) {
require_once self::$wpAutomation->getAbspath() . '/wp-includes/shortcodes.php';
}
self::$schemaInfo = new DbSchemaInfo([$schemaFile], self::$testConfig->testSite->dbTablePrefix, $wp_db_version);
$actionsInfoProvider = new ActionsInfoProvider([$actionsFile]);
$changeInfoFactory = new ChangeInfoFactory(self::$schemaInfo, $actionsInfoProvider);
$dbHost = self::$testConfig->testSite->dbHost;
$dbUser = self::$testConfig->testSite->dbUser;
$dbPassword = self::$testConfig->testSite->dbPassword;
$dbName = self::$testConfig->testSite->dbName;
$wpdb = new wpdb($dbUser, $dbPassword, $dbName, $dbHost);
$wpdb->set_prefix(self::$testConfig->testSite->dbTablePrefix);
self::$database = new Database($wpdb);
$shortcodesInfo = new ShortcodesInfo([$shortcodeFile]);
self::$vpidRepository = new VpidRepository(self::$database, self::$schemaInfo);
self::$shortcodesReplacer = new ShortcodesReplacer($shortcodesInfo, self::$vpidRepository);
$vpdbPath = self::$wpAutomation->getVpdbDir();
self::$tableSchemaRepository = new TableSchemaStorage(self::$database, $vpdbPath . '/.schema');
self::$storageFactory = new StorageFactory($vpdbPath, self::$schemaInfo, self::$database, [], $changeInfoFactory, self::$tableSchemaRepository);
self::$urlReplacer = new AbsoluteUrlReplacer(self::$testConfig->testSite->url);
}