You are here

class vfsStreamBlockTestCase in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamBlockTestCase.php \org\bovigo\vfs\vfsStreamBlockTestCase

Test for org\bovigo\vfs\vfsStreamBlock.

Hierarchy

Expanded class hierarchy of vfsStreamBlockTestCase

File

vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamBlockTestCase.php, line 14

Namespace

org\bovigo\vfs
View source
class vfsStreamBlockTestCase extends \PHPUnit_Framework_TestCase {

  /**
   * The block device being tested.
   *
   * @var vfsStreamBlock $block
   */
  protected $block;
  public function setUp() {
    $this->block = new vfsStreamBlock('foo');
  }

  /**
   * test default values and methods
   *
   * @test
   */
  public function defaultValues() {
    $this
      ->assertEquals(vfsStreamContent::TYPE_BLOCK, $this->block
      ->getType());
    $this
      ->assertEquals('foo', $this->block
      ->getName());
    $this
      ->assertTrue($this->block
      ->appliesTo('foo'));
    $this
      ->assertFalse($this->block
      ->appliesTo('foo/bar'));
    $this
      ->assertFalse($this->block
      ->appliesTo('bar'));
  }

  /**
   * tests how external functions see this object
   *
   * @test
   */
  public function external() {
    $root = vfsStream::setup('root');
    $root
      ->addChild(vfsStream::newBlock('foo'));
    $this
      ->assertEquals('block', filetype(vfsStream::url('root/foo')));
  }

  /**
   * tests adding a complex structure
   *
   * @test
   */
  public function addStructure() {
    $structure = array(
      'topLevel' => array(
        'thisIsAFile' => 'file contents',
        '[blockDevice]' => 'block contents',
      ),
    );
    $root = vfsStream::create($structure);
    $this
      ->assertSame('block', filetype(vfsStream::url('root/topLevel/blockDevice')));
  }

  /**
   * tests that a blank name for a block device throws an exception
   * @test
   * @expectedException org\bovigo\vfs\vfsStreamException
   */
  public function createWithEmptyName() {
    $structure = array(
      'topLevel' => array(
        'thisIsAFile' => 'file contents',
        '[]' => 'block contents',
      ),
    );
    $root = vfsStream::create($structure);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
vfsStreamBlockTestCase::$block protected property The block device being tested.
vfsStreamBlockTestCase::addStructure public function tests adding a complex structure
vfsStreamBlockTestCase::createWithEmptyName public function tests that a blank name for a block device throws an exception @test @expectedException org\bovigo\vfs\vfsStreamException
vfsStreamBlockTestCase::defaultValues public function test default values and methods
vfsStreamBlockTestCase::external public function tests how external functions see this object
vfsStreamBlockTestCase::setUp public function