vfsStreamAbstractVisitorTestCase.php in Zircon Profile 8.0
File
vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/visitor/vfsStreamAbstractVisitorTestCase.php
View source
<?php
namespace org\bovigo\vfs\visitor;
use org\bovigo\vfs\vfsStreamDirectory;
use org\bovigo\vfs\vfsStreamFile;
use org\bovigo\vfs\vfsStreamBlock;
class vfsStreamAbstractVisitorTestCase extends \PHPUnit_Framework_TestCase {
protected $abstractVisitor;
public function setUp() {
$this->abstractVisitor = $this
->getMock('org\\bovigo\\vfs\\visitor\\vfsStreamAbstractVisitor', array(
'visitFile',
'visitDirectory',
));
}
public function visitThrowsInvalidArgumentExceptionOnUnknownContentType() {
$mockContent = $this
->getMock('org\\bovigo\\vfs\\vfsStreamContent');
$mockContent
->expects($this
->any())
->method('getType')
->will($this
->returnValue('invalid'));
$this
->assertSame($this->abstractVisitor, $this->abstractVisitor
->visit($mockContent));
}
public function visitWithFileCallsVisitFile() {
$file = new vfsStreamFile('foo.txt');
$this->abstractVisitor
->expects($this
->once())
->method('visitFile')
->with($this
->equalTo($file));
$this
->assertSame($this->abstractVisitor, $this->abstractVisitor
->visit($file));
}
public function visitWithBlockCallsVisitFile() {
$block = new vfsStreamBlock('foo');
$this->abstractVisitor
->expects($this
->once())
->method('visitFile')
->with($this
->equalTo($block));
$this
->assertSame($this->abstractVisitor, $this->abstractVisitor
->visit($block));
}
public function visitWithDirectoryCallsVisitDirectory() {
$dir = new vfsStreamDirectory('bar');
$this->abstractVisitor
->expects($this
->once())
->method('visitDirectory')
->with($this
->equalTo($dir));
$this
->assertSame($this->abstractVisitor, $this->abstractVisitor
->visit($dir));
}
}