register() public static method

Please be aware that a call to this method will reset the root element to null. If the stream is already registered the method returns silently. If there is already another stream wrapper registered for the scheme used by vfsStream a vfsStreamException will be thrown.
public static register ( )
Example #1
0
 protected function setFileSystem()
 {
     vfsStreamWrapper::register();
     $root = vfsStream::newDirectory('build');
     vfsStreamWrapper::setRoot($root);
     return $root;
 }
Example #2
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'));
 }
Example #3
0
 public function setUp()
 {
     vfsStreamWrapper::register();
     vfsStreamWrapper::setRoot(new vfsStreamDirectory('logs'));
     $this->key = 'Logger\\Default';
     $this->factory = new LoggerFactory();
 }
Example #4
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  *
  * @return void
  */
 protected function setUp()
 {
     parent::setUp();
     $this->fileHandler = new FileHandlerPhp();
     vfsStreamWrapper::register();
     try {
         $testPath = $this->getTestPath();
         // Remove the files
         foreach ($this->resourcesToRemove as $path) {
             $fullPath = $testPath . $path;
             if (is_file($fullPath)) {
                 unlink($fullPath);
             }
         }
         // Remove the directories
         foreach ($this->resourcesToRemove as $path) {
             $fullPath = $testPath . $path;
             if (is_dir($fullPath)) {
                 rmdir($fullPath);
             }
         }
     } catch (\PHPUnit_Framework_SkippedTestError $e) {
     } catch (\PHPUnit_Framework_AssertionFailedError $e) {
     }
 }
 public function setUp()
 {
     vfsStreamWrapper::register();
     $root = vfsStream::setup('logs');
     $mockFile = vfsStream::newFile('logging_helper.log')->at($root);
     $root->addChild($mockFile);
 }
Example #6
0
 public function setUp()
 {
     $this->rootDir = new vfsStreamDirectory('queries');
     vfsStreamWrapper::register();
     vfsStreamWrapper::setRoot($this->rootDir);
     $this->loader = new FilesystemQueryLoader($this->rootDir->url());
 }
Example #7
0
 public function setUp()
 {
     $this->controllerCollection = \Mockery::mock("Silex\\ContainerCollection");
     $this->app = \Mockery::mock("Silex\\Application");
     $this->securityContainer = \Mockery::mock("Silktide\\LazyBoy\\Security\\SecurityContainer");
     vfsStreamWrapper::register();
 }
 protected function setUp()
 {
     parent::setUp();
     vfsStreamWrapper::register();
     $this->vfs = new vfsStreamDirectory('chunks');
     vfsStreamWrapper::setRoot($this->vfs);
 }
Example #9
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']);
 }
 /**
  * @test
  * @expectedException \Neos\FluidAdaptor\View\Exception\InvalidTemplateResourceException
  */
 public function getPartialPathAndFilenameThrowsExceptionIfPartialFileIsADirectory()
 {
     vfsStreamWrapper::register();
     mkdir('vfs://MyPartials/NotAFile');
     $this->standaloneView->setPartialRootPath('vfs://MyPartials');
     $this->standaloneView->getTemplatePaths()->getPartialSource('NotAFile');
 }
Example #11
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'));
 }
Example #12
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'));
 }
Example #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->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);
 }
Example #14
0
 /**
  * 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'));
 }
 public function tearDownCacheDir()
 {
     vfsStreamWrapper::register();
     $cacheDir = vfsStream::url('zf2-module-test');
     if (is_dir($cacheDir)) {
         static::rmdir($cacheDir);
     }
 }
Example #16
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');
 }
Example #17
0
 function __construct()
 {
     parent::__construct();
     vfsStreamWrapper::register();
     \Mockery::getConfiguration()->allowMockingNonExistentMethods(false);
     $this->objectMother = new \UnitTest\Lib\ObjectMother($this);
     $this->onCreate();
 }
Example #18
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());
 }
Example #20
0
 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')];
 }
 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();
 }
Example #22
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));
 }
Example #23
0
 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;
 }
Example #24
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();
 }
Example #25
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');
 }
Example #27
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());
 }
Example #28
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;
 }
 /**
  * @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);
 }
 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;
 }