getAbspath() public method

public getAbspath ( )
 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);
 }
Ejemplo n.º 2
0
 private static function staticInitialization()
 {
     self::$testConfig = TestConfig::createDefaultConfig();
     self::$wpAutomation = new WpAutomation(self::$testConfig->testSite, self::$testConfig->wpCliVersion);
     $yamlDir = self::$wpAutomation->getPluginsDir() . '/versionpress/.versionpress';
     $schemaFile = $yamlDir . '/schema.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);
     $rawTaxonomies = self::$wpAutomation->runWpCliCommand('taxonomy', 'list', ['format' => 'json', 'fields' => 'name']);
     $taxonomies = array_column(json_decode($rawTaxonomies, true), 'name');
     $dbHost = self::$testConfig->testSite->dbHost;
     $dbUser = self::$testConfig->testSite->dbUser;
     $dbPassword = self::$testConfig->testSite->dbPassword;
     $dbName = self::$testConfig->testSite->dbName;
     $dbPrefix = self::$testConfig->testSite->dbTablePrefix;
     self::$database = new \mysqli($dbHost, $dbUser, $dbPassword, $dbName);
     self::$wpdb = new \wpdb($dbUser, $dbPassword, $dbName, $dbHost);
     self::$wpdb->set_prefix($dbPrefix);
     self::$vp_database = new Database(self::$wpdb);
     $shortcodesInfo = new ShortcodesInfo([$shortcodeFile]);
     self::$vpidRepository = new VpidRepository(self::$vp_database, self::$schemaInfo);
     self::$shortcodesReplacer = new ShortcodesReplacer($shortcodesInfo, self::$vpidRepository);
     $vpdbPath = self::$wpAutomation->getVpdbDir();
     $tableSchemaRepository = new TableSchemaStorage(self::$vp_database, $vpdbPath . '/.schema');
     self::$storageFactory = new StorageFactory($vpdbPath, self::$schemaInfo, self::$vp_database, $taxonomies, null, $tableSchemaRepository);
     require self::$wpAutomation->getPluginsDir() . '/versionpress/.versionpress/hooks.php';
     self::defineGlobalVariables();
 }