class vfsStreamAbstractVisitorTestCase in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/visitor/vfsStreamAbstractVisitorTestCase.php \org\bovigo\vfs\visitor\vfsStreamAbstractVisitorTestCase
Test for org\bovigo\vfs\visitor\vfsStreamAbstractVisitor.
@since 0.10.0 @group issue_10
Hierarchy
- class \org\bovigo\vfs\visitor\vfsStreamAbstractVisitorTestCase extends \org\bovigo\vfs\visitor\PHPUnit_Framework_TestCase
Expanded class hierarchy of vfsStreamAbstractVisitorTestCase
See also
https://github.com/mikey179/vfsStream/issues/10
File
- vendor/
mikey179/ vfsStream/ src/ test/ php/ org/ bovigo/ vfs/ visitor/ vfsStreamAbstractVisitorTestCase.php, line 21
Namespace
org\bovigo\vfs\visitorView source
class vfsStreamAbstractVisitorTestCase extends \PHPUnit_Framework_TestCase {
/**
* instance to test
*
* @var vfsStreamAbstractVisitor
*/
protected $abstractVisitor;
/**
* set up test environment
*/
public function setUp() {
$this->abstractVisitor = $this
->getMock('org\\bovigo\\vfs\\visitor\\vfsStreamAbstractVisitor', array(
'visitFile',
'visitDirectory',
));
}
/**
* @test
* @expectedException \InvalidArgumentException
*/
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));
}
/**
* @test
*/
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));
}
/**
* tests that a block device eventually calls out to visit file
*
* @test
*/
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));
}
/**
* @test
*/
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));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
vfsStreamAbstractVisitorTestCase:: |
protected | property | instance to test | |
vfsStreamAbstractVisitorTestCase:: |
public | function | set up test environment | |
vfsStreamAbstractVisitorTestCase:: |
public | function | @test @expectedException \InvalidArgumentException | |
vfsStreamAbstractVisitorTestCase:: |
public | function | tests that a block device eventually calls out to visit file | |
vfsStreamAbstractVisitorTestCase:: |
public | function | @test | |
vfsStreamAbstractVisitorTestCase:: |
public | function | @test |