VersionPress\Tests\Automation\WpAutomation::getUploadsDir PHP Method

getUploadsDir() public method

public getUploadsDir ( )
    public function getUploadsDir()
    {
        static $uploads = false;
        if ($uploads === false) {
            $uploads = $this->runWpCliCommand('eval', null, ['print(wp_upload_dir()["basedir"]);']) ?: null;
        }
        return $uploads;
    }

Usage Example

 public function __construct($name = null, array $data = [], $dataName = '')
 {
     parent::__construct($name, $data, $dataName);
     $this->staticInitialization();
     $this->gitRepository = new GitRepository(self::$testConfig->testSite->path);
     self::$wpAutomation = new WpAutomation(self::$testConfig->testSite, self::$testConfig->wpCliVersion);
     $vpdbDir = self::$wpAutomation->getVpdbDir();
     $relativePathToVpdb = PathUtils::getRelativePath(self::$testConfig->testSite->path, $vpdbDir);
     $uploadsDir = self::$wpAutomation->getUploadsDir();
     $relativePathToUploads = PathUtils::getRelativePath(self::$testConfig->testSite->path, $uploadsDir);
     $dbSchema = new DbSchemaInfo([self::$wpAutomation->getPluginsDir() . '/versionpress/.versionpress/schema.yml'], self::$testConfig->testSite->dbTablePrefix, PHP_INT_MAX);
     $actionsInfoProvider = new ActionsInfoProvider([self::$wpAutomation->getPluginsDir() . '/versionpress/.versionpress/actions.yml']);
     $this->commitAsserter = new CommitAsserter($this->gitRepository, $dbSchema, $actionsInfoProvider, ['vpdb' => $relativePathToVpdb, 'uploads' => $relativePathToUploads]);
 }