FilemodeExampleTestCaseWithVfsStream.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. * This file is part of vfsStream.
  4. *
  5. * For the full copyright and license information, please view the LICENSE
  6. * file that was distributed with this source code.
  7. *
  8. * @package org\bovigo\vfs
  9. */
  10. namespace org\bovigo\vfs\example;
  11. use org\bovigo\vfs\vfsStream;
  12. require_once 'FilemodeExample.php';
  13. /**
  14. * Test case for class FilemodeExample.
  15. */
  16. class FilemodeExampleTestCaseWithVfsStream extends \PHPUnit_Framework_TestCase
  17. {
  18. /**
  19. * root directory
  20. *
  21. * @type vfsStreamDirectory
  22. */
  23. protected $root;
  24. /**
  25. * set up test environmemt
  26. */
  27. public function setUp()
  28. {
  29. $this->root = vfsStream::setup('exampleDir');
  30. }
  31. /**
  32. * test that the directory is created
  33. */
  34. public function testDirectoryIsCreatedWithDefaultPermissions()
  35. {
  36. $example = new FilemodeExample('id');
  37. $example->setDirectory(vfsStream::url('exampleDir'));
  38. $this->assertEquals(0700, $this->root->getChild('id')->getPermissions());
  39. }
  40. /**
  41. * test that the directory is created
  42. */
  43. public function testDirectoryIsCreatedWithGivenPermissions()
  44. {
  45. $example = new FilemodeExample('id', 0755);
  46. $example->setDirectory(vfsStream::url('exampleDir'));
  47. $this->assertEquals(0755, $this->root->getChild('id')->getPermissions());
  48. }
  49. }
  50. ?>