setRoot() public static méthode

sets the root content
public static setRoot ( org\bovigo\vfs\vfsStreamContainer $root ) : org\bovigo\vfs\vfsStreamContainer
$root org\bovigo\vfs\vfsStreamContainer
Résultat org\bovigo\vfs\vfsStreamContainer
Exemple #1
0
 /**
  * Sets up the test fixture.
  *
  * @return void
  */
 public function setUp()
 {
     vfsStreamWrapper::register();
     vfsStreamWrapper::setRoot(new vfsStreamDirectory('test'));
     $this->forum = 'test';
     $this->contents = new Forum_Contents(vfsStream::url('test'));
 }
Exemple #2
0
 public function setUp()
 {
     $this->rootDir = new vfsStreamDirectory('queries');
     vfsStreamWrapper::register();
     vfsStreamWrapper::setRoot($this->rootDir);
     $this->loader = new FilesystemQueryLoader($this->rootDir->url());
 }
Exemple #3
0
 /**
  * Discards VFS file system changes
  *
  * @return EcomDev_PHPUnit_Model_Fixture_Vfs
  */
 public function discard()
 {
     if ($this->_currentRoot) {
         StreamWrapper::setRoot(array_pop($this->_currentRoot));
     }
     return $this;
 }
 protected function setUp()
 {
     parent::setUp();
     vfsStreamWrapper::register();
     $this->vfs = new vfsStreamDirectory('chunks');
     vfsStreamWrapper::setRoot($this->vfs);
 }
Exemple #5
0
 public function setUp()
 {
     vfsStreamWrapper::register();
     vfsStreamWrapper::setRoot(new vfsStreamDirectory('logs'));
     $this->key = 'Logger\\Default';
     $this->factory = new LoggerFactory();
 }
Exemple #6
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $this->ini = new Ini();
     $this->filename = realpath(__DIR__ . "/../../../data/test.ini");
     vfsStreamWrapper::register();
     vfsStreamWrapper::setRoot(new vfsStreamDirectory('root'));
 }
Exemple #7
0
 /**
  * Tests the YAML file discovery.
  */
 public function testDiscovery()
 {
     vfsStreamWrapper::register();
     $root = new vfsStreamDirectory('modules');
     vfsStreamWrapper::setRoot($root);
     $url = vfsStream::url('modules');
     mkdir($url . '/test_1');
     file_put_contents($url . '/test_1/test_1.test.yml', 'name: test');
     file_put_contents($url . '/test_1/test_2.test.yml', 'name: test');
     mkdir($url . '/test_2');
     file_put_contents($url . '/test_2/test_3.test.yml', 'name: test');
     // Write an empty YAML file.
     file_put_contents($url . '/test_2/test_4.test.yml', '');
     // Set up the directories to search.
     $directories = array('test_1' => $url . '/test_1', 'test_2' => $url . '/test_1', 'test_3' => $url . '/test_2', 'test_4' => $url . '/test_2');
     $discovery = new YamlDiscovery('test', $directories);
     $data = $discovery->findAll();
     $this->assertEquals(count($data), count($directories));
     $this->assertArrayHasKey('test_1', $data);
     $this->assertArrayHasKey('test_2', $data);
     $this->assertArrayHasKey('test_3', $data);
     $this->assertArrayHasKey('test_4', $data);
     foreach (array('test_1', 'test_2', 'test_3') as $key) {
         $this->assertArrayHasKey('name', $data[$key]);
         $this->assertEquals($data[$key]['name'], 'test');
     }
     $this->assertSame(array(), $data['test_4']);
 }
Exemple #8
0
 protected function setFileSystem()
 {
     vfsStreamWrapper::register();
     $root = vfsStream::newDirectory('build');
     vfsStreamWrapper::setRoot($root);
     return $root;
 }
Exemple #9
0
 public function testCacheWSDLIsWorldWritable()
 {
     vfsStreamWrapper::register();
     vfsStreamWrapper::setRoot(new vfsStreamDirectory('tmp'));
     $SOAP = $this->getMock('SSRS\\Soap\\NTLM', array('setCacheWSDLPermission'), array('http://'));
     $SOAP->expects($this->once())->method('setCacheWSDLPermission')->with($this->equalTo(0666));
     $SOAP->setCachePath(vfsStream::url('tmp/file.wsdl'))->cacheWSDL('$fileContents');
 }
Exemple #10
0
 /**
  * PHPUnit cannot add this to code coverage
  *
  * @codeCoverageIgnore
  *
  * @param $swaggerPath
  *
  * @throws \org\bovigo\vfs\vfsStreamException
  */
 public static function initSchemaManager($swaggerPath)
 {
     vfsStreamWrapper::register();
     vfsStreamWrapper::setRoot(new vfsStreamDirectory('root'));
     file_put_contents(vfsStream::url('root') . '/swagger.json', json_encode(Yaml::parse(file_get_contents($swaggerPath))));
     self::$schemaManager = new SchemaManager(vfsStream::url('root') . '/swagger.json');
     self::$document = new SwaggerDocument($swaggerPath);
 }
 public function setUp()
 {
     $this->buildDir = new vfsStreamDirectory('build');
     vfsStreamWrapper::register();
     vfsStreamWrapper::setRoot($this->buildDir);
     $this->filesystem = m::mock('Symfony\\Component\\Filesystem\\Filesystem');
     $this->application = new Application($this->getMockKernel());
 }
 public function setUp()
 {
     vfsStreamWrapper::register();
     $root = new vfsStreamDirectory('root');
     vfsStreamWrapper::setRoot($root);
     vfsStream::copyFromFileSystem(__DIR__ . '/../package');
     $this->config = ['version' => '1.0.4', 'configFile' => vfsStream::url('root/app/code/community/Slovenian/LocalePackSl/etc/config.xml'), 'packageFile' => vfsStream::url('root/package.xml')];
 }
Exemple #13
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $this->csv = new Csv();
     $this->largeCsv = realpath(__DIR__ . "/../../../data/Large.csv");
     $this->smallCsv = realpath(__DIR__ . "/../../../data/Small.csv");
     vfsStreamWrapper::register();
     vfsStreamWrapper::setRoot(new vfsStreamDirectory('root'));
 }
 protected function setUp()
 {
     $this->root = new vfsStreamDirectory('test');
     vfsStreamWrapper::register();
     vfsStreamWrapper::setRoot($this->root);
     $this->responder = new StaticHtmlFileResponder($this->root->url(), 'file');
     $this->response = new Response();
 }
Exemple #15
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $this->object = new NlReader();
     vfsStreamWrapper::register();
     $root = vfsStream::newDirectory('tmp');
     vfsStreamWrapper::setRoot($root);
     $this->file = vfsStream::newFile('items.csv', 0764)->withContent("73-ou-XW46\nApple\n1\na")->at($root);
 }
 /**
  * Sets up this testcase
  *
  * @return void
  */
 protected function setUp()
 {
     if (!class_exists('org\\bovigo\\vfs\\vfsStreamWrapper')) {
         $this->markTestSkipped('File backend tests are not available with this phpunit version.');
     }
     vfsStreamWrapper::register();
     vfsStreamWrapper::setRoot(new vfsStreamDirectory('Foo'));
 }
Exemple #17
0
 /**
  * @see \PHPUnit_Framework_TestCase::setUp()
  */
 protected function setUp()
 {
     $this->options = new Options();
     $this->manager = new Manager($this->options);
     $root = 'root';
     vfsStreamWrapper::register();
     vfsStreamWrapper::setRoot(new vfsStreamDirectory($root));
     $this->options->setFilePath(vfsStream::url($root));
 }
 protected function setFileSystem()
 {
     vfsStreamWrapper::register();
     $root = vfsStream::newDirectory('build');
     vfsStreamWrapper::setRoot($root);
     $packagesBuilder = new PackagesBuilder(new NullOutput(), vfsStream::url('build'), array('repositories' => array(array('type' => 'composer', 'url' => 'http://localhost:54715')), 'require' => array('vendor/name' => '*')), false);
     $packagesBuilder->dump(array($this->package));
     return $root;
 }
Exemple #19
0
 public function testExtractPublicKeyToFileWriteError()
 {
     $root = vfsStream::newDirectory('test');
     $root->addChild(vfsStream::newFile('test.key', 00));
     vfsStreamWrapper::setRoot($root);
     $this->setExpectedException('RuntimeException', 'The public key file "vfs://test/test.key" could not be written:');
     $key = $this->helper->createPrivateKey('test');
     $this->helper->extractPublicKeyToFile('vfs://test/test.key', $key, 'test');
 }
Exemple #20
0
 /** @test */
 public function attachPhoto()
 {
     $pic = 'photo.jpg';
     vfsStreamWrapper::register();
     $root = vfsStream::newDirectory('pics');
     vfsStreamWrapper::setRoot($root);
     vfsStream::newFile($pic)->at($root);
     $this->entry->attachPhoto(vfsStream::url('pics/' . $pic));
     $this->assertTrue($this->entry->hasPhoto());
 }
 public function setUp()
 {
     $buildDir = new vfsStreamDirectory('build');
     $this->buildDirectory = $buildDir->url();
     vfsStreamWrapper::register();
     vfsStreamWrapper::setRoot($buildDir);
     $this->filesystem = new Filesystem();
     $this->filesystem->mkdir($this->buildDirectory);
     $this->writer = new FilesystemWriter($this->filesystem, $this->buildDirectory, 'index.html');
 }
Exemple #22
0
 /**
  * Sets up the test fixture.
  *
  * @return void
  *
  * @global array The paths of system files and folders.
  * @global array The localization of the plugins.
  */
 public function setUp()
 {
     global $pth, $plugin_tx;
     vfsStreamWrapper::register();
     vfsStreamWrapper::setRoot(new vfsStreamDirectory('test'));
     $this->_rootFolder = vfsStream::url('test/');
     $this->_csvFile = $this->_rootFolder . 'test.csv';
     $plugin_tx = array('advancedform' => array('error_form_missing' => 'form %s missing'));
     $this->_setUpMocks();
 }
 public function setup()
 {
     $this->pidFactory = \Mockery::mock("Silktide\\Teamster\\Pool\\Pid\\PidFactoryInterface");
     $this->pid = \Mockery::mock("Silktide\\Teamster\\Pool\\Pid\\PidInterface")->shouldIgnoreMissing(true);
     $this->pidFactory->shouldReceive("create")->andReturn($this->pid);
     $this->pid->shouldReceive("getPid")->withArgs([true])->andThrow("Silktide\\Teamster\\Exception\\PidException");
     $this->defaultDescriptorSpec = [0 => ["pipe", "r"], 1 => ["pipe", "w"], 2 => ["pipe", "w"]];
     $this->consolePath = __DIR__ . "/output/console.php";
     vfsStreamWrapper::setRoot(new vfsStreamDirectory($this->testDir));
 }
Exemple #24
0
 protected function setUp()
 {
     parent::setUp();
     // Setup virtual file system
     vfsStreamWrapper::register();
     $this->vfs = new vfsStreamDirectory('chunks');
     vfsStreamWrapper::setRoot($this->vfs);
     // Setup Config
     $this->config = new Config();
     $this->config->setTempDir($this->vfs->url());
 }
 /**
  * @test
  */
 public function willAddResponsesToDocument()
 {
     $minimalDocumentPath = __DIR__ . '/../DocumentFixer/assets/minimal.yml';
     vfsStreamWrapper::register();
     vfsStreamWrapper::setRoot(new vfsStreamDirectory('willAddResponsesToDocument'));
     $amendedPath = vfsStream::url('willAddResponsesToDocument/modified.yml');
     $this->commandTester->execute(['command' => AmendSwaggerDocumentCommand::NAME, 'file' => $minimalDocumentPath, '--out' => $amendedPath]);
     $modifiedContent = file_get_contents($amendedPath);
     $this->assertContains('responses', $modifiedContent);
     $amendedData = Yaml::parse($modifiedContent);
     $this->assertArrayHasKey('responses', $amendedData);
 }
 public function setup()
 {
     $this->metadata = \Mockery::mock("Silktide\\Reposition\\Metadata\\EntityMetadata");
     $this->metadata->shouldReceive("getCollection")->andReturn("test", "one");
     $this->intermediaryMetadata = \Mockery::mock("Silktide\\Reposition\\Metadata\\EntityMetadata");
     $this->metadataProvider = \Mockery::mock("Silktide\\Reposition\\Metadata\\EntityMetadataProviderInterface");
     $this->metadataProvider->shouldReceive("getEntityMetadata")->andReturn($this->metadata);
     $this->metadataProvider->shouldReceive("getEntityMetadataForIntermediary")->andReturn($this->intermediaryMetadata);
     $this->outputDir = vfsStream::url($this->testDir);
     vfsStreamWrapper::register();
     vfsStreamWrapper::setRoot(new vfsStreamDirectory($this->testDir, 0777));
 }
Exemple #27
0
 protected function getAssetMap()
 {
     vfsStream::setup();
     vfsStreamWrapper::register();
     vfsStreamWrapper::setRoot(new vfsStreamDirectory('asset'));
     $mapPath = 'vfs://asset/map.json';
     $asset = new AssetMap($mapPath);
     $assets = ['asset.js' => 'asset-path.js'];
     file_put_contents($mapPath, json_encode($assets));
     $map = new AssetMap($mapPath);
     return $map;
 }
    public static function setUpBeforeClass()
    {
        self::$mtime = time();
        self::$fixtureString = '<' . '?php
			$EM_CONF[$_EXTKEY] = ' . var_export(self::$fixture, TRUE) . ';
		';
        $emConf = new vfsStreamFile('ext_emconf.php');
        $emConf->setContent(self::$fixtureString);
        vfsStreamWrapper::register();
        vfsStreamWrapper::setRoot(new vfsStreamDirectory('temp', 0777));
        vfsStreamWrapper::getRoot()->addChild($emConf);
    }
 public static function newFile($contents, $fileName = null, $root = null)
 {
     $root = is_null($root) ? 'root' : $root;
     $fileName = is_null($fileName) ? 'test.txt' : $fileName;
     vfsStreamWrapper::register();
     vfsStreamWrapper::setRoot(new vfsStreamDirectory($root));
     $file = vfsStream::newFile($fileName);
     $file->setContent($contents);
     vfsStreamWrapper::getRoot()->addChild($file);
     $virtualPath = vfsStream::url($root . '/' . $fileName);
     return $virtualPath;
 }
 protected function makeJsonSelectHandler($filesPresent = false)
 {
     vfsStreamWrapper::register();
     vfsStreamWrapper::setRoot(new vfsStreamDirectory("testSaveDir"));
     if ($filesPresent) {
         $directory = new vfsStreamDirectory('Test');
         $directory->addChild(new vfsStreamFile('Test.json'));
         vfsStreamWrapper::getRoot()->addChild($directory);
     }
     $jsonSelectHandler = new JsonSelectHandler(vfsStream::url("testSaveDir"));
     return $jsonSelectHandler;
 }