本文整理汇总了PHP中vfsStreamWrapper::getRoot方法的典型用法代码示例。如果您正苦于以下问题:PHP vfsStreamWrapper::getRoot方法的具体用法?PHP vfsStreamWrapper::getRoot怎么用?PHP vfsStreamWrapper::getRoot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vfsStreamWrapper
的用法示例。
在下文中一共展示了vfsStreamWrapper::getRoot方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set_up
public function set_up()
{
$this->helper('directory');
vfsStreamWrapper::register();
vfsStreamWrapper::setRoot(new vfsStreamDirectory('testDir'));
$this->_test_dir = vfsStreamWrapper::getRoot();
}
示例2: testDirectoryIsCreated
/**
* test that the directory is created
*/
public function testDirectoryIsCreated()
{
$example = new Example('id');
$this->assertFalse(vfsStreamWrapper::getRoot()->hasChild('id'));
$example->setDirectory(vfsStream::url('exampleDir'));
$this->assertTrue(vfsStreamWrapper::getRoot()->hasChild('id'));
}
示例3: testGenerateTest
/**
* @covers Generator::generate_test
*/
function testGenerateTest()
{
mkdir(vfsStream::url('root/test/unit'), 0777, true);
file_put_contents(vfsStream::url('root/template/unit_test.tmpl'), '{class_name}');
Generator::generate_test('unit', 'Unit');
$this->assertTrue(vfsStreamWrapper::getRoot()->hasChild('test/unit/UnitTest.php'));
$this->assertEquals("Unit", file_get_contents(vfsStream::url('test/unit/UnitTest.php')));
}
示例4: setUp
function setUp()
{
TestRequire::vfs($this);
vfsStreamWrapper::register();
vfsStreamWrapper::setRoot(new vfsStreamDirectory('r'));
$this->fsroot = vfsStreamWrapper::getRoot();
$this->ua = new UnitAnalyzer();
}
示例5: testScriptExistsAndFails
function testScriptExistsAndFails()
{
vfsStream::newFile('script')->at(vfsStreamWrapper::getRoot());
$script_runner = new TryLib_Precheck_ScriptRunner(vfsStream::url('testDir/script'));
$this->mock_cmd_runner->expects($this->once())->method('run')->with('vfs://testDir/script', false, true)->will($this->returnValue(255));
$this->mock_cmd_runner->expects($this->once())->method('terminate')->with('Failed running pre-check script vfs://testDir/script');
$script_runner->check($this->mock_cmd_runner, 'repoPath', 'origin/master');
}
示例6: setUp
protected function setUp()
{
TestRequire::vfs($this);
$this->fa = new FrequencyAnalyzer();
vfsStreamWrapper::register();
vfsStreamWrapper::setRoot(new vfsStreamDirectory('r'));
$this->fs = vfsStreamWrapper::getRoot();
}
示例7: setUp
/**
* Setup
*/
protected function setUp()
{
if ($this->isVsfStreamInstalled()) {
vfsStream::setup();
$this->setTestDirectory(vfsStream::newDirectory('tests')->at(vfsStreamWrapper::getRoot()));
define('CLIENT_DATA_DIR', vfsStream::url('root/tests'));
}
parent::setUp();
}
示例8: setUp
/**
* Prepares the environment before running a test.
*/
protected function setUp()
{
parent::setUp();
vfsStream::setup('exampleDir');
$file = vfsStream::newFile('test1.php');
vfsStreamWrapper::getRoot()->addChild($file);
$file->setContent('__' . '("test1"); __' . '(\'test2\')');
$this->Translation_File_Source = new Translation_File_Source(vfsStream::url('exampleDir/test1.php'));
}
示例9: testExtractSource
/**
* @dataProvider extractSource_dp
*/
public function testExtractSource($units, $file_content, $expected)
{
$f = vfsStream::newFile('file.php', 0664);
$f->withContent($file_content);
vfsStreamWrapper::getRoot()->addChild($f);
$this->sa->extractSource($units[0]);
$this->assertEquals(explode("\n", $expected['src']), explode("\n", $units[0]['src']));
$this->assertEquals(explode("\n", $expected['src_strip']), explode("\n", $units[0]['src_strip']));
$this->assertEquals(explode("\n", $expected['sloc']), explode("\n", $units[0]['sloc']));
$this->assertEquals(explode("\n", $expected['err']), explode("\n", $units[0]['err']));
}
示例10: set_up
function set_up()
{
$obj = new stdClass();
$obj->upload = new Mock_Libraries_Upload();
$obj->security = new Mock_Core_Security();
$obj->lang = new Mock_Core_Lang();
$this->ci_instance($obj);
$this->upload = $obj->upload;
vfsStreamWrapper::register();
vfsStreamWrapper::setRoot(new vfsStreamDirectory('testDir'));
$this->_test_dir = vfsStreamWrapper::getRoot();
}
示例11: setUp
protected function setUp()
{
global $xml_file_data;
TestRequire::vfs($this);
vfsStreamWrapper::register();
vfsStreamWrapper::setRoot(new vfsStreamDirectory('r'));
$this->fs = vfsStreamWrapper::getRoot();
$f = new vfsStreamFile('file.xml', 0664);
$f->withContent($xml_file_data);
$this->fs->addChild($f);
$this->xa = new XMLAnalyzer(vfsStream::url('file.xml'));
}
示例12: newFile
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;
}
示例13: setUp
/**
* Prepares the environment before running a test.
*/
protected function setUp()
{
parent::setUp();
vfsStream::setup('exampleDir');
$dir = vfsStream::newDirectory('subDir1');
vfsStreamWrapper::getRoot()->addChild($dir);
vfsStreamWrapper::getRoot()->addChild(vfsStream::newFile('test1.php'));
$dir->addChild(vfsStream::newFile('test2.php'));
$dir->addChild(vfsStream::newFile('test3.js'));
$dir->addChild(vfsStream::newFile('test4.xml'));
$extentions = array('php' => array('PHP'));
$this->Translation_Collector_Source_Files = new Translation_Collector_Source_Files(new RecursiveIteratorIterator(new RecursiveDirectoryIterator(vfsStream::url('exampleDir'))), $extentions);
}
示例14: initializeObjectRemovesALockFileIfItsOlderThanTheMaximumTime
/**
* @test
* @author Robert Lemke <robert@typo3.org>
*/
public function initializeObjectRemovesALockFileIfItsOlderThanTheMaximumTime()
{
$temporaryDirectoryUrl = \vfsStream::url('TestDirectory') . '/';
file_put_contents($temporaryDirectoryUrl . 'FLOW3.lock', '');
\vfsStreamWrapper::getRoot()->getChild('FLOW3.lock')->setFilemtime(time() - \F3\FLOW3\Core\LockManager::LOCKFILE_MAXIMUM_AGE - 2);
$mockEnvironment = $this->getMock('F3\\FLOW3\\Utility\\Environment');
$mockEnvironment->expects($this->once())->method('getPathToTemporaryDirectory')->will($this->returnValue($temporaryDirectoryUrl));
$lockManager = new \F3\FLOW3\Core\LockManager();
$lockManager->injectEnvironment($mockEnvironment);
$lockManager->initializeObject();
$this->assertFalse($lockManager->isSiteLocked());
$this->assertFalse(file_exists($temporaryDirectoryUrl . 'FLOW3.lock'));
}
示例15: __construct
/**
* Since we use paths to load up models, views, etc, we need the ability to
* mock up the file system so when core tests are run, we aren't mucking
* in the application directory. this will give finer grained control over
* these tests. So yeah, while this looks odd, I need to overwrite protected
* class vars in the loader. So here we go...
*
* @covers CI_Loader::__construct()
*/
public function __construct()
{
vfsStreamWrapper::register();
vfsStreamWrapper::setRoot(new vfsStreamDirectory('application'));
$this->models_dir = vfsStream::newDirectory('models')->at(vfsStreamWrapper::getRoot());
$this->libs_dir = vfsStream::newDirectory('libraries')->at(vfsStreamWrapper::getRoot());
$this->helpers_dir = vfsStream::newDirectory('helpers')->at(vfsStreamWrapper::getRoot());
$this->views_dir = vfsStream::newDirectory('views')->at(vfsStreamWrapper::getRoot());
$this->_ci_ob_level = ob_get_level();
$this->_ci_library_paths = array(vfsStream::url('application') . '/', BASEPATH);
$this->_ci_helper_paths = array(vfsStream::url('application') . '/', BASEPATH);
$this->_ci_model_paths = array(vfsStream::url('application') . '/');
$this->_ci_view_paths = array(vfsStream::url('application') . '/views/' => TRUE);
}