ae8919367c0569ec70fda8ddc10c5efb5e371451
[yaffs-website] / vendor / mikey179 / vfsStream / src / test / php / org / bovigo / vfs / vfsStreamResolveIncludePathTestCase.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\vfsStream.
13  *
14  * @since  0.9.0
15  * @group  issue_5
16  */
17 class vfsStreamResolveIncludePathTestCase extends \PHPUnit_Framework_TestCase
18 {
19     /**
20      * include path to restore after test run
21      *
22      * @var  string
23      */
24     protected $backupIncludePath;
25
26     /**
27      * set up test environment
28      */
29     public function setUp()
30     {
31         $this->backupIncludePath = get_include_path();
32         vfsStream::setup();
33         mkdir('vfs://root/a/path', 0777, true);
34         set_include_path('vfs://root/a' . PATH_SEPARATOR . $this->backupIncludePath);
35     }
36
37     /**
38      * clean up test environment
39      */
40     public function tearDown()
41     {
42         set_include_path($this->backupIncludePath);
43     }
44
45     /**
46      * @test
47      */
48     public function knownFileCanBeResolved()
49     {
50         file_put_contents('vfs://root/a/path/knownFile.php', '<?php ?>');
51         $this->assertEquals('vfs://root/a/path/knownFile.php', stream_resolve_include_path('path/knownFile.php'));
52     }
53
54     /**
55      * @test
56      */
57     public function unknownFileCanNotBeResolvedYieldsFalse()
58     {
59         $this->assertFalse(@stream_resolve_include_path('path/unknownFile.php'));
60     }
61 }