[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/infrastructure/testing/fixture/ -> PhabricatorStorageFixtureScopeGuard.php (source)

   1  <?php
   2  
   3  /**
   4   * Used by unit tests to build storage fixtures.
   5   */
   6  final class PhabricatorStorageFixtureScopeGuard {
   7  
   8    private $name;
   9  
  10    public function __construct($name) {
  11      $this->name = $name;
  12  
  13      execx(
  14        'php %s upgrade --force --namespace %s',
  15        $this->getStorageBinPath(),
  16        $this->name);
  17  
  18      PhabricatorLiskDAO::pushStorageNamespace($name);
  19  
  20      // Destructor is not called with fatal error.
  21      register_shutdown_function(array($this, 'destroy'));
  22    }
  23  
  24    public function destroy() {
  25      PhabricatorLiskDAO::popStorageNamespace();
  26  
  27      execx(
  28        'php %s destroy --force --namespace %s',
  29        $this->getStorageBinPath(),
  30        $this->name);
  31    }
  32  
  33    private function getStorageBinPath() {
  34      $root = dirname(phutil_get_library_root('phabricator'));
  35      return $root.'/scripts/sql/manage_storage.php';
  36    }
  37  
  38  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1