本文整理汇总了PHP中vfsStream::newDirectory方法的典型用法代码示例。如果您正苦于以下问题:PHP vfsStream::newDirectory方法的具体用法?PHP vfsStream::newDirectory怎么用?PHP vfsStream::newDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vfsStream
的用法示例。
在下文中一共展示了vfsStream::newDirectory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testProviderReturnsAResultForEveryInstalledLanguage
/**
* @param ilTermsOfServiceAgreementByLanguageProvider $provider
* @depends testAgreementByLanguageProviderCanBeCreatedByFactory
*/
public function testProviderReturnsAResultForEveryInstalledLanguage(ilTermsOfServiceAgreementByLanguageProvider $provider)
{
$client_rel_path = implode('/', array('clients', 'default', 'agreement'));
$global_rel_path = implode('/', array('global', 'agreement'));
$root = vfsStreamWrapper::setRoot(new vfsStreamDirectory('root'));
$customizing_dir = vfsStream::newDirectory('Customizing')->at($root);
$client_dir = vfsStream::newDirectory($client_rel_path)->at($customizing_dir);
vfsStream::newFile('agreement_de.html', 0777)->at($client_dir);
file_put_contents(vfsStream::url('root/Customizing/' . $client_rel_path . '/agreement_de.html'), 'phpunit');
$global_dir = vfsStream::newDirectory($global_rel_path)->at($customizing_dir);
vfsStream::newFile('agreement_en.html', 0777)->at($global_dir);
file_put_contents(vfsStream::url('root/Customizing/' . $global_rel_path . '/agreement_en.html'), 'phpunit');
$provider->setSourceDirectories(array(vfsStream::url('root/Customizing/' . $client_rel_path), vfsStream::url('root/Customizing/' . $global_rel_path)));
$lng = $this->getMockBuilder('ilLanguage')->disableOriginalConstructor()->getMock();
$installed_languages = array('en', 'de', 'fr');
$lng->expects($this->once())->method('getInstalledLanguages')->will($this->onConsecutiveCalls($installed_languages));
$provider->setLanguageAdapter($lng);
$data = $provider->getList(array(), array());
$this->assertArrayHasKey('items', $data);
$this->assertArrayHasKey('cnt', $data);
$this->assertCount(count($installed_languages), $data['items']);
$this->assertEquals(count($installed_languages), $data['cnt']);
for ($i = 0; $i < count($installed_languages); $i++) {
$this->assertArrayHasKey('language', $data['items'][$i]);
$this->assertArrayHasKey('agreement', $data['items'][$i]);
$this->assertArrayHasKey('agreement_document', $data['items'][$i]);
$this->assertArrayHasKey('agreement_document_modification_ts', $data['items'][$i]);
if ($installed_languages[$i] == 'fr') {
$this->assertFalse(file_exists($data['items'][$i]['agreement_document']));
} else {
$this->assertTrue(file_exists($data['items'][$i]['agreement_document']));
}
}
}
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:38,代码来源:ilTermsOfServiceAgreementsByLanguageTableDataProviderTest.php
示例2: testShouldRenameDirectoryNameAsStringInternal
/**
* Test: should rename directory name as string internal
*
* @small
*/
public function testShouldRenameDirectoryNameAsStringInternal()
{
$dir = $this->rootDirectory->getChild('var/log/app');
$dir->addChild(vfsStream::newDirectory(80));
$child = $this->rootDirectory->getChild('var/log/app/80');
$child->rename(90);
static::assertNotNull($this->rootDirectory->getChild('var/log/app/90'));
}
示例3: setUp
/**
* set up test environment
*/
public function setUp()
{
if (extension_loaded('zip') === false) {
$this->markTestSkipped('No ext/zip installed, skipping test.');
}
$this->markTestSkipped('Zip extension can not work with vfsStream urls.');
vfsStreamWrapper::register();
vfsStreamWrapper::setRoot(vfsStream::newDirectory('root'));
}
示例4: 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();
}
示例5: specialClassNamesAndPathsSettingsOverrideClassLoaderBehaviour
/**
* @test
* @author Karsten Dambekalns <karsten@typo3.org>
*/
public function specialClassNamesAndPathsSettingsOverrideClassLoaderBehaviour()
{
$root = \vfsStream::newDirectory('Packages/Virtual/Resources/PHP');
\vfsStreamWrapper::setRoot($root);
$vfsClassFile = \vfsStream::newFile('Bar.php')->withContent('<?php ?>')->at($root->getChild('Virtual/Resources/PHP'));
$this->classLoader->setSpecialClassNameAndPath('Baz', \vfsStream::url('Virtual/Resources/PHP/Bar.php'));
$this->classLoader->loadClass('Baz');
$this->assertTrue($vfsClassFile->eof());
}
示例6: setUp
/**
* set up test environment
*/
public function setUp()
{
$this->rootDirectory = vfsStream::newDirectory('/');
$this->rootDirectory->addChild(vfsStream::newDirectory('var/log/app'));
$dir = $this->rootDirectory->getChild('var/log/app');
$dir->addChild(vfsStream::newDirectory('app1'));
$dir->addChild(vfsStream::newDirectory('app2'));
$dir->addChild(vfsStream::newDirectory('foo'));
}
示例7: it_should_look_for_taskfile_in_parent_directories
/**
* it should look for pantrfile in parent directories
* @author Patrick Gotthardt
* @test
*/
public function it_should_look_for_taskfile_in_parent_directories()
{
$file = vfsStream::url('r/pantrfile.php');
file_put_contents($file, 'test');
$basedir = 'r/foo/bar/baz';
$dir = vfsStream::newDirectory($basedir);
$fac = new CyclicResolutionTaskFileFactory(vfsStream::url($basedir));
$pfile = $fac->getTaskFile('pantrfile');
$this->assertNotNull($pfile);
}
示例8: setUp
public function setUp()
{
if (class_exists('vfsStream', false) === false) {
$this->markTestSkipped('vfsStream not installed.');
}
vfsStreamWrapper::register();
$root = vfsStream::newDirectory('home/test');
$root->getChild('test')->addChild(vfsStream::newFile('succeed.php'));
$root->getChild('test')->addChild(vfsStream::newFile('succeed2.php'));
$root->getChild('test')->addChild(vfsStream::newFile('succeed3.php'));
vfsStreamWrapper::setRoot($root);
}
示例9: setup
/**
* helper method for setting up vfsStream with the proxy
*
* @param string $rootDirName optional name of root directory
* @param int $permissions optional file permissions of root directory
* @return vfsStreamDirectory
* @throws vfsStreamException
*/
public static function setup($rootDirName = 'root', $permissions = null)
{
self::$root = vfsStream::newDirectory($rootDirName, $permissions);
if (true === self::$registered) {
return self::$root;
}
if (@stream_wrapper_register(vfsStream::SCHEME, __CLASS__) === false) {
throw new vfsStreamException('A handler has already been registered for the ' . vfsStream::SCHEME . ' protocol.');
}
self::$registered = true;
return self::$root;
}
示例10: setUp
protected function setUp()
{
$root = vfsStream::setup('PasswordLibTest');
//Setup Folders
$core = vfsStream::newDirectory('Core')->at($root);
$af = vfsStream::newDirectory('AbstractFactory')->at($core);
// Create Files
vfsStream::newFile('test.php')->at($af);
vfsStream::newFile('Some234Foo234Bar98Name.php')->at($af);
vfsStream::newFile('Invalid.csv')->at($af);
vfsStream::newFile('badlocation.php')->at($core);
}
示例11: setUp
/**
*
*/
public function setUp()
{
vfsStreamWrapper::register();
$root = vfsStreamWrapper::setRoot(new vfsStreamDirectory('root'));
$customizing_dir = vfsStream::newDirectory('Customizing')->at($root);
$this->client_dir = vfsStream::newDirectory('clients/default/agreement')->at($customizing_dir);
$this->global_dir = vfsStream::newDirectory('global/agreement')->at($customizing_dir);
$this->lng = $this->getMockBuilder('ilLanguage')->disableOriginalConstructor()->getMock();
$this->lng->expects($this->any())->method('getLangKey')->will($this->returnValue('de'));
$this->lng->expects($this->any())->method('getDefaultLanguage')->will($this->returnValue('fr'));
$this->source_files = array(vfsStream::url(implode('/', array('root', 'Customizing', 'clients', 'default', 'agreement', 'agreement_' . $this->lng->getLangKey() . '.html'))) => $this->lng->getLangKey(), vfsStream::url(implode('/', array('root', 'Customizing', 'clients', 'default', 'agreement', 'agreement_' . $this->lng->getDefaultLanguage() . '.html'))) => $this->lng->getDefaultLanguage(), vfsStream::url(implode('/', array('root', 'Customizing', 'clients', 'default', 'agreement', 'agreement_en.html'))) => 'en', vfsStream::url(implode('/', array('root', 'Customizing', 'global', 'agreement', 'agreement_' . $this->lng->getLangKey() . '.html'))) => $this->lng->getLangKey(), vfsStream::url(implode('/', array('root', 'Customizing', 'global', 'agreement', 'agreement_' . $this->lng->getDefaultLanguage() . '.html'))) => $this->lng->getDefaultLanguage(), vfsStream::url(implode('/', array('root', 'Customizing', 'global', 'agreement', 'agreement_en.html'))) => 'en');
}
示例12: 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);
}
示例13: __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);
}
示例14: setUp
public function setUp()
{
if (class_exists('vfsStream', false) === false) {
$this->markTestSkipped('vfsStream not installed.');
}
vfsStreamWrapper::register();
$root = vfsStream::newDirectory('home/config');
$root->getChild('config')->addChild(vfsStream::newFile('crypto.php')->withContent('
<?php $config_auth["keyphrase"] = "moo"; $config_auth["base_salt"] = "baa"; ?>
'));
vfsStreamWrapper::setRoot($root);
self::$slc = $this->getMock('\\Core\\Session\\LocalStorage', array('get', 'set', 'destroy'));
self::$srp = $this->getMock('\\Core\\Session\\RemoteStorage', array('set_remote_addr', '__set', '__get', 'save', 'add', 'load', 'destroy'));
self::$sh = new \Core\Session\Handler();
self::$sh->set_remote_addr(TEST_IP)->attach_local_storage(self::$slc)->attach_remote_storage(self::$srp)->initialize_remote_storage()->attach_crypto_config('vfs://config/crypto.php');
}
示例15: copyFromWithSubFolders
/**
* @test
* @group issue_4
* @since 0.11.0
*/
public function copyFromWithSubFolders()
{
$baseDir = vfsStream::copyFromFileSystem($this->getFileSystemCopyDir(), vfsStream::newDirectory('test'), 3);
$this->assertTrue($baseDir->hasChildren());
$this->assertTrue($baseDir->hasChild('emptyFolder'));
$this->assertTrue($baseDir->hasChild('withSubfolders'));
$subfolderDir = $baseDir->getChild('withSubfolders');
$this->assertTrue($subfolderDir->hasChild('subfolder1'));
$this->assertTrue($subfolderDir->getChild('subfolder1')->hasChild('file1.txt'));
$this->assertVfsFile($subfolderDir->getChild('subfolder1/file1.txt'), '');
$this->assertTrue($subfolderDir->hasChild('subfolder2'));
$this->assertTrue($subfolderDir->hasChild('aFile.txt'));
$this->assertVfsFile($subfolderDir->getChild('aFile.txt'), 'foo');
}