本文整理汇总了PHP中vfsStream类的典型用法代码示例。如果您正苦于以下问题:PHP vfsStream类的具体用法?PHP vfsStream怎么用?PHP vfsStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了vfsStream类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
$config = new stdClass();
$config->paths = new stdClass();
$config->paths->docroot = null;
$config->site = new stdClass();
$config->site->mode = 'prod';
$config->site->cdnPrefix = 'a';
$config->defaults = new stdClass();
$config->defaults->cdnPrefix = '';
$config->defaults->mediaVersion = 'a';
parent::__construct(array('config' => $config));
if (class_exists('vfsStream')) {
vfsStreamWrapper::register();
vfsStreamWrapper::setRoot(new vfsStreamDirectory('assetDir'));
$config->paths->docroot = vfsStream::url('assetDir');
}
$this->docroot = $config->paths->docroot;
$this->cacheDir = sprintf('%s/assets/cache', $this->docroot);
$this->assets = $this->assetsRel = array('js' => array(), 'css' => array());
$siteMode = $config->site->mode;
if ($siteMode === 'prod') {
$this->mode = self::minified;
} else {
$this->mode = self::combined;
}
$this->returnAsHeader = false;
}
开发者ID:gg1977,项目名称:frontend,代码行数:28,代码来源:AssetPipelineTest.php
示例2: setUp
public function setUp()
{
if (class_exists('vfsStream')) {
vfsStreamWrapper::register();
vfsStreamWrapper::setRoot(new vfsStreamDirectory('scriptsDir'));
$this->scriptsDir = vfsStream::url('scriptsDir');
mkdir($upgradeDir = "{$this->scriptsDir}/upgrade");
mkdir("{$this->scriptsDir}/upgrade/readme");
mkdir("{$this->scriptsDir}/upgrade/base");
mkdir("{$this->scriptsDir}/upgrade/db");
mkdir("{$this->scriptsDir}/upgrade/db/mysql");
mkdir("{$this->scriptsDir}/upgrade/fs");
$this->assertTrue(is_dir($upgradeDir));
}
$this->config = new stdClass();
$this->config->paths = new stdClass();
$this->config->paths->configs = $this->scriptsDir;
$this->config->defaults = new stdClass();
$this->config->defaults->currentCodeVersion = '1.1.1';
$this->config->defaults->lastCodeVersion = '2.2.2';
$this->config->site = new stdClass();
$this->config->site->lastCodeVersion = '3.3.3';
$params = array('config' => $this->config);
$this->upgrade = new Upgrade($params);
}
开发者ID:nicolargo,项目名称:frontend,代码行数:25,代码来源:UpgradeTest.php
示例3: generateExtensionFromVersion1Configuration
/**
* This test creates an extension based on a JSON file, generated
* with version 1.0 of the ExtensionBuilder and compares all
* generated files with the originally created ones
* This test should help, to find compatibility breaking changes
*
* @test
*/
function generateExtensionFromVersion1Configuration()
{
$this->configurationManager = $this->getMock($this->buildAccessibleProxy('Tx_ExtensionBuilder_Configuration_ConfigurationManager'), array('dummy'));
$this->extensionSchemaBuilder = $this->objectManager->get('Tx_ExtensionBuilder_Service_ExtensionSchemaBuilder');
$testExtensionDir = PATH_typo3conf . 'ext/extension_builder/Tests/Examples/TestExtensions/test_extension_v1/';
$jsonFile = $testExtensionDir . Tx_ExtensionBuilder_Configuration_ConfigurationManager::EXTENSION_BUILDER_SETTINGS_FILE;
if (file_exists($jsonFile)) {
// compatibility adaptions for configurations from older versions
$extensionConfigurationJSON = json_decode(file_get_contents($jsonFile), TRUE);
$extensionConfigurationJSON = $this->configurationManager->fixExtensionBuilderJSON($extensionConfigurationJSON);
} else {
$this->fail('JSON file not found');
}
$this->extension = $this->extensionSchemaBuilder->build($extensionConfigurationJSON);
$this->codeGenerator->setSettings(array('codeTemplateRootPath' => PATH_typo3conf . 'ext/extension_builder/Resources/Private/CodeTemplates/Extbase/', 'extConf' => array('enableRoundtrip' => '0')));
$newExtensionDir = vfsStream::url('testDir') . '/';
$this->extension->setExtensionDir($newExtensionDir . 'test_extension/');
$this->codeGenerator->build($this->extension);
$referenceFiles = t3lib_div::getAllFilesAndFoldersInPath(array(), $testExtensionDir);
foreach ($referenceFiles as $referenceFile) {
$createdFile = str_replace($testExtensionDir, $this->extension->getExtensionDir(), $referenceFile);
if (!in_array(basename($createdFile), array('ExtensionBuilder.json'))) {
// json file is generated by controller
$referenceFileContent = str_replace(array('2011-08-11', '###YEAR###'), array(date('Y-m-d'), date('Y')), file_get_contents($referenceFile));
//t3lib_div::writeFile(PATH_site.'fileadmin/'.basename($createdFile), file_get_contents($createdFile));
$this->assertFileExists($createdFile, 'File ' . $createdFile . ' was not created!');
$this->assertEquals(t3lib_div::trimExplode("\n", $referenceFileContent, TRUE), t3lib_div::trimExplode("\n", file_get_contents($createdFile), TRUE), 'File ' . $createdFile . ' was not equal to original file.');
}
}
}
开发者ID:rafu1987,项目名称:t3bootstrap-project,代码行数:38,代码来源:CompatibilityTest.php
示例4: testWriteRecord
/**
* @dataProvider writeRecordProvider
* @param unknown_type $record
* @param unknown_type $expected
* @param unknown_type $escape
*/
public function testWriteRecord($record, $expected, $escape, $lr)
{
$dir = vfsStream::setup('base');
$sut = new Dfp_Datafeed_File_Writer_Format_Csv_File();
$passed = $passed2 = false;
try {
$sut->writeRecord(array('test', 'testing', '2.35', '"test"'));
} catch (Dfp_Datafeed_File_Writer_Exception $e) {
if ($e->getMessage() == 'The file is not open') {
$passed = True;
}
}
$sut->open(vfsStream::url('base/test.csv'));
try {
$sut->writeRecord(array('test', 'testing', '2.35', '"test"'));
} catch (Dfp_Datafeed_File_Writer_Exception $e) {
if ($e->getMessage() == 'The dialect is invalid') {
$passed2 = True;
}
}
$mockDialect = $this->getMock('Dfp_Datafeed_File_Format_Csv_Dialect_Interface');
$mockDialect->expects($this->any())->method('getQuote')->will($this->returnValue('"'));
$mockDialect->expects($this->any())->method('getDelimiter')->will($this->returnValue(','));
$mockDialect->expects($this->any())->method('getEscape')->will($this->returnValue($escape));
$mockDialect->expects($this->any())->method('getLineReturn')->will($this->returnValue($lr));
$sut->setDialect($mockDialect);
$sut->writeRecord($record);
$this->assertEquals($expected, file_get_contents(vfsStream::url('base/test.csv')));
//echo "\n\n";var_dump(getcwd());
}
开发者ID:henryhayes,项目名称:dfp,代码行数:36,代码来源:FileTest.php
示例5: setUp
/**
* set up test environment
*/
public function setUp()
{
vfsStream::setup('root');
$this->rootDir = vfsStream::url('root');
$this->lostAndFound = $this->rootDir . '/lost+found/';
mkdir($this->lostAndFound);
}
开发者ID:mikey179,项目名称:vfsstream,代码行数:10,代码来源:FilenameTestCase.php
示例6: setUp
/**
* Prepares the environment before running a test.
*/
protected function setUp()
{
parent::setUp();
vfsStreamWrapper::register();
vfsStreamWrapper::setRoot(new vfsStreamDirectory('exampleDir'));
$this->Translation_File_Output = new Translation_File_Output_JavaScript(vfsStream::url('exampleDir/subdir1/subdir2/test.js'));
}
开发者ID:spalax,项目名称:zf2-translation-scanner,代码行数:10,代码来源:OutputTest.php
示例7: 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
示例8: 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'));
}
开发者ID:pago,项目名称:pantr,代码行数:10,代码来源:ExampleTestCaseWithVfsStream.php
示例9: testGenerateXml
/**
* @large
*/
public function testGenerateXml()
{
$syntaxFile = $this->fixtureDir . DIRECTORY_SEPARATOR . "test_grammar.ebnf";
\vfsStream::setup("testdir");
$this->assertEquals(Command::EBNF_OK, Command::main(array("s" => $syntaxFile, "o" => \vfsStream::url("testdir/out.xml"), "f" => "xml")));
$this->assertEquals(file_get_contents($this->fixtureDir . DIRECTORY_SEPARATOR . "test_grammar.xml"), file_get_contents(\vfsStream::url("testdir/out.xml")));
}
开发者ID:bgarrels,项目名称:ebnf,代码行数:10,代码来源:CommandTest.php
示例10: setUp
/**
* set up test environment
*/
public function setUp()
{
$this->backupIncludePath = get_include_path();
vfsStream::setup();
mkdir('vfs://root/a/path', 0777, true);
set_include_path('vfs://root/a' . PATH_SEPARATOR . $this->backupIncludePath);
}
开发者ID:sunkangtaichi,项目名称:PHPAPPLISTION_START,代码行数:10,代码来源:vfsStreamResolveIncludePathTestCase.php
示例11: testGetTranslations_shouldReturnEmptyArray
public function testGetTranslations_shouldReturnEmptyArray()
{
$root = vfsStream::setup('root');
$root->addChild(new vfsStreamFile('language.php'));
$obj = new Language_File(vfsStream::url('root/language.php'));
$this->assertEquals(array(), $obj->getTranslations());
}
开发者ID:railfuture,项目名称:tiki-website,代码行数:7,代码来源:ParseFileTest.php
示例12: setLogFileSetsLogFile
/**
* @test
*/
public function setLogFileSetsLogFile()
{
$this->setUpVfsStream();
vfsStream::newFile($this->logFileName)->at(vfsStreamWrapper::getRoot());
$writer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Log\\Writer\\FileWriter');
$writer->setLogFile($this->getDefaultFileName());
$this->assertAttributeEquals($this->getDefaultFileName(), 'logFile', $writer);
}
开发者ID:noxludo,项目名称:TYPO3v4-Core,代码行数:11,代码来源:class.t3lib_log_writer_fileTest.php
示例13: __construct
/**
* constructor
*
* @param vfsStreamContent[] $children
*/
public function __construct(array $children)
{
$this->children = $children;
if (vfsStream::useDotfiles()) {
array_unshift($this->children, new DotDirectory('.'), new DotDirectory('..'));
}
reset($this->children);
}
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:13,代码来源:vfsStreamContainerIterator.php
示例14: __construct
/**
* constructor
*
* @param string $name
* @param int $permissions
*/
public function __construct($name, $permissions = 0777)
{
$this->name = $name;
$this->lastModified = time();
$this->permissions = $permissions;
$this->user = vfsStream::getCurrentUser();
$this->group = vfsStream::getCurrentGroup();
}
开发者ID:pago,项目名称:pantr,代码行数:14,代码来源:vfsStreamAbstractContent.php
示例15: getLanguagesScansFormatDirectoryAndReturnsLanguagesAsStrings
/**
* @test
*/
public function getLanguagesScansFormatDirectoryAndReturnsLanguagesAsStrings()
{
$formatPath = \vfsStream::url('testDirectory') . '/';
\TYPO3\FLOW3\Utility\Files::createDirectoryRecursively($formatPath . 'en');
$format = new \TYPO3\FLOW3\Package\Documentation\Format('DocBook', $formatPath);
$availableLanguages = $format->getAvailableLanguages();
$this->assertEquals(array('en'), $availableLanguages);
}
开发者ID:nxpthx,项目名称:FLOW3,代码行数:11,代码来源:FormatTest.php
示例16: 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'));
}
开发者ID:mikey179,项目名称:vfsstream,代码行数:13,代码来源:vfsStreamDirectoryIssue134TestCase.php
示例17: 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');
}
开发者ID:seanly,项目名称:TryLib,代码行数:8,代码来源:ScriptRunnerTest.php
示例18: provideSwitchWithExpectations
/**
* @return array
*/
public function provideSwitchWithExpectations()
{
return array(array(function () {
vfsStream::disableDotfiles();
}, array()), array(function () {
vfsStream::enableDotfiles();
}, array('.', '..')));
}
开发者ID:mikey179,项目名称:vfsstream,代码行数:11,代码来源:vfsStreamContainerIteratorTestCase.php
示例19: testScanDir_shouldAcceptIncludedFiles
public function testScanDir_shouldAcceptIncludedFiles()
{
$obj = $this->getMock('Language_CollectFiles', array('getExcludeDirs', 'getIncludeFiles'));
$obj->expects($this->exactly(3))->method('getExcludeDirs')->will($this->returnValue(array('vfs://root/dir2')));
$obj->expects($this->exactly(2))->method('getIncludeFiles')->will($this->returnValue(array('vfs://root/dir2/file3.php')));
$expectedResult = array('vfs://root/dir1/file1.tpl', 'vfs://root/dir2/file3.php');
$this->assertEquals($expectedResult, $obj->scanDir(vfsStream::url('root')));
}
开发者ID:railfuture,项目名称:tiki-website,代码行数:8,代码来源:CollectFilesTest.php
示例20: _getVirtualFsRoot
/**
* Initialize virtual filesystem
*
* @param string $directoryName The root of the vfs
* @return string The created vfs' root
*/
protected function _getVirtualFsRoot($directoryName)
{
//prepare vfs
//setup vfsSW, root directory
vfsStreamWrapper::register();
vfsStreamWrapper::setRoot(new vfsStreamDirectory($directoryName));
return vfsStream::url($directoryName);
}
开发者ID:erenon,项目名称:Light,代码行数:14,代码来源:PageFileMapperTest.php
注:本文中的vfsStream类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论