예제 #1
0
 protected function setUp()
 {
     $this->root = vfsStream::setup('dev.flaming-archer');
     vfsStream::create(array('config.dist.php' => 'config without secure data', 'vendor' => array()), $this->root);
     $webroot = vfsStream::url('dev.flaming-archer');
     parent::setUp();
     // Replacing default vendor directory with mocked filesystem
     $this->composerConfig->merge(array('config' => array('vendor-dir' => $webroot . '/vendor')));
 }
예제 #2
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $this->rootPath = APPLICATION_PATH . '/tests/_files/tmp';
     $filesystem = new \Composer\Util\Filesystem();
     $filesystem->ensureDirectoryExists($this->rootPath);
     // Copy the application config over the test directory
     copy(APPLICATION_PATH . '/config.dist.php', $this->rootPath . '/config.php');
     $this->assertFileExists($this->rootPath . '/config.php', 'Application config was not copied correctly during setup.');
     // Get application config and ensure path to db exists
     $this->applicationConfig = (include $this->rootPath . '/config.php');
     $this->dbFile = $this->applicationConfig['database'];
     $filesystem->ensureDirectoryExists(pathinfo($this->dbFile, PATHINFO_DIRNAME));
     // Copy the sql schema used to create the database
     $filesystem->ensureDirectoryExists($this->rootPath . '/scripts/sql');
     copy(APPLICATION_PATH . '/scripts/sql/schema.sql', $this->rootPath . '/scripts/sql/schema.sql');
     $this->assertFileExists($this->rootPath . '/scripts/sql/schema.sql', 'Database schema file was not copied correctly during setup.');
     parent::setUp();
     // Create Composer config
     $this->composerConfig->merge(array('config' => array('vendor-dir' => realpath($this->rootPath) . '/vendor')));
 }