本文整理汇总了PHP中vfsStream::setup方法的典型用法代码示例。如果您正苦于以下问题:PHP vfsStream::setup方法的具体用法?PHP vfsStream::setup怎么用?PHP vfsStream::setup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vfsStream
的用法示例。
在下文中一共展示了vfsStream::setup方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
* set up test environment
*/
public function setUp()
{
vfsStream::setup()->lastModified(50)->lastAccessed(50)->lastAttributeModified(50);
$this->fooUrl = vfsStream::url('root/foo.txt');
$this->barUrl = vfsStream::url('root/bar');
$this->bazUrl = vfsStream::url('root/bar/baz.txt');
}
示例2: setUp
function setUp()
{
parent::setUp();
$this->mock_cmd_runner = $this->getMock('TryLib_CommandRunner');
$this->jenkins_runner = new TestRunner(self::JENKINS_URL, self::JENKINS_CLI, self::JENKINS_JOB, $this->mock_cmd_runner);
vfsStream::setup('testDir');
}
示例3: 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")));
}
示例4: setUpVfsStream
protected function setUpVfsStream()
{
if (!class_exists('vfsStream')) {
$this->markTestSkipped('File backend tests are not available with this phpunit version.');
}
\vfsStream::setup('LogRoot');
}
示例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);
}
示例6: 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);
}
示例7: 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());
}
示例8: 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());
}
示例9: setUp
public function setUp()
{
$this->mountDir = uniqid('mount-');
$this->basedir = uniqid('base-');
\vfsStream::setup($this->basedir);
// Add an entry for the mount directory to the VFS contents
$this->vfsContents = array($this->mountDir => array());
}
示例10: canNotRemoveWritableFileFromNonWritableDirectory
/**
* @test
* @group issue_51
*/
public function canNotRemoveWritableFileFromNonWritableDirectory()
{
$structure = array('test_directory' => array('test.file' => ''));
$root = vfsStream::setup('root', null, $structure);
$root->getChild('test_directory')->chmod(0444);
$root->getChild('test_directory')->getChild('test.file')->chmod(0777);
$this->assertFalse(@unlink(vfsStream::url('root/test_directory/test.file')));
}
示例11: setUp
protected function setUp()
{
// setup a mock filesystem
$lang = vfsStream::setup('lang');
$this->langFile = new vfsStreamFile('language.php');
$lang->addChild($this->langFile);
$this->filePath = vfsStream::url('lang/language.php');
$this->obj = new Language_WriteFile_Factory();
}
示例12: vfsStreamCanHandleUrlEncodedPath
/**
* @test
*/
public function vfsStreamCanHandleUrlEncodedPath()
{
$content = '<xs:schema targetNamespace="http://www.example.com" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="myType"></xs:complexType>
</xs:schema>';
$structure = array('foo bar' => array('schema.xsd' => $content));
vfsStream::setup('root', null, $structure);
$this->assertEquals($content, file_get_contents(vfsStream::url('root/foo bar/schema.xsd')));
}
示例13: unlinkNonExistingFileTriggersError
/**
* @test
* @since 1.4.0
* @group issue_68
*/
public function unlinkNonExistingFileTriggersError()
{
vfsStream::setup();
try {
$this->assertFalse(unlink('vfs://root/foo.txt'));
} catch (\PHPUnit_Framework_Error $fe) {
$this->assertEquals('unlink(vfs://root/foo.txt): No such file or directory', $fe->getMessage());
}
}
示例14: __construct
/**
* Registers vfsStream
*
* @param PHPUnit_Framework_TestCase $testCase
*
* @return vfsStreamHelper_Wrapper
*/
public function __construct(PHPUnit_Framework_TestCase $testCase, $mountPoint = 'root')
{
@(include_once 'vfsStream/vfsStream.php');
if (!class_exists('vfsStreamWrapper')) {
$testCase->markTestSkipped('vfsStream is not available - skipping');
} else {
vfsStream::setup($mountPoint);
}
}
示例15: 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'));
}