/** * test setting and getting the content of a file * * @test */ public function content() { $this->assertNull($this->file->getContent()); $this->assertSame($this->file, $this->file->setContent('bar')); $this->assertEquals('bar', $this->file->getContent()); $this->assertSame($this->file, $this->file->withContent('baz')); $this->assertEquals('baz', $this->file->getContent()); }
/** * @dataProvider analyze_dp */ public function testAnalyze($data, $file_content, $expected) { $f = new vfsStreamFile('file.php', 0664); $f->withContent($file_content); $this->fs->addChild($f); $this->fa->analyze($data); $this->assertEquals($expected, $data); }
/** * @dataProvider analyze_dp */ function testAnalyze($data, $file_content, $expected) { foreach ($data['files'] as $k => $file) { $f = new vfsStreamFile($file, 0664); $f->withContent($file_content[$k]); $this->fsroot->addChild($f); $data['files'][$k] = vfsStream::url($data['files'][$k]); } $this->ua->analyze($data); $this->assertEquals($expected, $data); }
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')); }
/** * @test * @group issue_79 * @expectedException \InvalidArgumentException * @since 1.3.0 */ public function withContentThrowsInvalidArgumentExceptionWhenContentIsNoStringAndNoFileContent() { $this->file->withContent(313); }