19c40fd950a0478485d3f24e80f0ef8d2c3ee129
[yaffs-website] / vendor / mikey179 / vfsStream / src / test / php / org / bovigo / vfs / vfsStreamWrapperBaseTestCase.php
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;
11 /**
12  * Test for org\bovigo\vfs\vfsStreamWrapper.
13  */
14 abstract class vfsStreamWrapperBaseTestCase extends \PHPUnit_Framework_TestCase
15 {
16     /**
17      * root directory
18      *
19      * @var  vfsStreamDirectory
20      */
21     protected $foo;
22     /**
23      * URL of root directory
24      *
25      * @var  string
26      */
27     protected $fooURL;
28     /**
29      * sub directory
30      *
31      * @var  vfsStreamDirectory
32      */
33     protected $bar;
34     /**
35      * URL of sub directory
36      *
37      * @var  string
38      */
39     protected $barURL;
40     /**
41      * a file
42      *
43      * @var  vfsStreamFile
44      */
45     protected $baz1;
46     /**
47      * URL of file 1
48      *
49      * @var  string
50      */
51     protected $baz1URL;
52     /**
53      * another file
54      *
55      * @var  vfsStreamFile
56      */
57     protected $baz2;
58     /**
59      * URL of file 2
60      *
61      * @var  string
62      */
63     protected $baz2URL;
64
65     /**
66      * set up test environment
67      */
68     public function setUp()
69     {
70         $this->fooURL  = vfsStream::url('foo');
71         $this->barURL  = vfsStream::url('foo/bar');
72         $this->baz1URL = vfsStream::url('foo/bar/baz1');
73         $this->baz2URL = vfsStream::url('foo/baz2');
74         $this->foo     = new vfsStreamDirectory('foo');
75         $this->bar     = new vfsStreamDirectory('bar');
76         $this->baz1    = vfsStream::newFile('baz1')
77                                   ->lastModified(300)
78                                   ->lastAccessed(300)
79                                   ->lastAttributeModified(300)
80                                   ->withContent('baz 1');
81         $this->baz2    = vfsStream::newFile('baz2')
82                                   ->withContent('baz2')
83                                   ->lastModified(400)
84                                   ->lastAccessed(400)
85                                   ->lastAttributeModified(400);
86         $this->bar->addChild($this->baz1);
87         $this->foo->addChild($this->bar);
88         $this->foo->addChild($this->baz2);
89         $this->foo->lastModified(100)
90                   ->lastAccessed(100)
91                   ->lastAttributeModified(100);
92         $this->bar->lastModified(200)
93                   ->lastAccessed(100)
94                   ->lastAttributeModified(100);
95         vfsStreamWrapper::register();
96         vfsStreamWrapper::setRoot($this->foo);
97     }
98 }