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 ( )
コード例 #1
0
ファイル: WebBuilderDumpTest.php プロジェクト: ausger/satis
 protected function setFileSystem()
 {
     vfsStreamWrapper::register();
     $root = vfsStream::newDirectory('build');
     vfsStreamWrapper::setRoot($root);
     return $root;
 }
コード例 #2
0
ファイル: ContentsTest.php プロジェクト: TN03/forum_xh
 /**
  * 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'));
 }
コード例 #3
0
ファイル: LoggerFactoryTest.php プロジェクト: mhilker/common
 public function setUp()
 {
     vfsStreamWrapper::register();
     vfsStreamWrapper::setRoot(new vfsStreamDirectory('logs'));
     $this->key = 'Logger\\Default';
     $this->factory = new LoggerFactory();
 }
コード例 #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) {
     }
 }
コード例 #5
0
 public function setUp()
 {
     vfsStreamWrapper::register();
     $root = vfsStream::setup('logs');
     $mockFile = vfsStream::newFile('logging_helper.log')->at($root);
     $root->addChild($mockFile);
 }
コード例 #6
0
ファイル: FilesystemTest.php プロジェクト: cocur/nqm
 public function setUp()
 {
     $this->rootDir = new vfsStreamDirectory('queries');
     vfsStreamWrapper::register();
     vfsStreamWrapper::setRoot($this->rootDir);
     $this->loader = new FilesystemQueryLoader($this->rootDir->url());
 }
コード例 #7
0
ファイル: RouteLoaderTest.php プロジェクト: silktide/lazy-boy
 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();
 }
コード例 #8
0
 protected function setUp()
 {
     parent::setUp();
     vfsStreamWrapper::register();
     $this->vfs = new vfsStreamDirectory('chunks');
     vfsStreamWrapper::setRoot($this->vfs);
 }
コード例 #9
0
ファイル: YamlDiscoveryTest.php プロジェクト: aWEBoLabs/taxi
 /**
  * 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']);
 }
コード例 #10
0
 /**
  * @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');
 }
コード例 #11
0
ファイル: IniTest.php プロジェクト: mceldeen/mce
 /**
  * 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'));
 }
コード例 #12
0
ファイル: CsvTest.php プロジェクト: mceldeen/mce
 /**
  * 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'));
 }
コード例 #13
0
ファイル: NlReaderTest.php プロジェクト: aonamrata/FileParser
 /**
  * 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);
 }
コード例 #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'));
 }
コード例 #15
0
 public function tearDownCacheDir()
 {
     vfsStreamWrapper::register();
     $cacheDir = vfsStream::url('zf2-module-test');
     if (is_dir($cacheDir)) {
         static::rmdir($cacheDir);
     }
 }
コード例 #16
0
ファイル: NTLMTest.php プロジェクト: caseypage/php-ssrs-1
 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');
 }
コード例 #17
0
ファイル: BaseTestCase.php プロジェクト: noikiy/tools
 function __construct()
 {
     parent::__construct();
     vfsStreamWrapper::register();
     \Mockery::getConfiguration()->allowMockingNonExistentMethods(false);
     $this->objectMother = new \UnitTest\Lib\ObjectMother($this);
     $this->onCreate();
 }
コード例 #18
0
ファイル: ApiTestCase.php プロジェクト: krizon/swagger-bundle
 /**
  * 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);
 }
コード例 #19
0
 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());
 }
コード例 #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')];
 }
コード例 #21
0
 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();
 }
コード例 #22
0
ファイル: ManagerTest.php プロジェクト: cross-solution/yawik
 /**
  * @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));
 }
コード例 #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;
 }
コード例 #24
0
ファイル: CsvTest.php プロジェクト: bbfriend/advancedform_xh
 /**
  * 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();
 }
コード例 #25
0
ファイル: EntryTest.php プロジェクト: seregazhuk/php-dayone
 /** @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());
 }
コード例 #26
0
 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');
 }
コード例 #27
0
ファイル: FileTest.php プロジェクト: mrsad/Dru.io
 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());
 }
コード例 #28
0
ファイル: AssetMapTest.php プロジェクト: dmitrynaum/sam
 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;
 }
コード例 #29
0
 /**
  * @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;
 }