CheckTest::testIsAbsolutePathWindows()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 3
rs 10
1
<?php
2
/**
3
 * This file is part of camino.
4
 *
5
 * (c) Sebastian Feldmann <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace SebastianFeldmann\Camino;
11
12
use PHPUnit\Framework\TestCase;
13
14
/**
15
 * Class CheckTest
16
 *
17
 * @package SebastianFeldmann\Camino
18
 */
19
class CheckTest extends TestCase
20
{
21
    /**
22
     * Tests Check::isAbsolutePath
23
     */
24
    public function testIsAbsolutePathTrue()
25
    {
26
        $this->assertTrue(Check::isAbsolutePath('/foo/bar'));
27
    }
28
29
    /**
30
     * Tests Check::isAbsolutePath
31
     */
32
    public function testIsRelativePathNotBeingAbsolute()
33
    {
34
        $this->assertFalse(Check::isAbsolutePath('../foo/bar'));
35
    }
36
37
    /**
38
     * Tests Check::isAbsolutePath
39
     */
40
    public function testIsAbsolutePathStream()
41
    {
42
        $this->assertTrue(Check::isAbsolutePath('php://foo/bar'));
43
    }
44
45
    /**
46
     * Tests Check::isAbsolutePathWindows
47
     *
48
     * @dataProvider providerWindowsPaths
49
     *
50
     * @param string  $path
51
     * @param boolean $expected
52
     */
53
    public function testIsAbsolutePathWindows($path, $expected)
54
    {
55
        $this->assertEquals($expected, Check::isAbsolutePath($path));
56
    }
57
58
    /**
59
     * Data provider testIsAbsolutePathWindows.
60
     *
61
     * @return array
62
     */
63
    public function providerWindowsPaths()
64
    {
65
        return [
66
            ['C:\foo', true],
67
            ['\\foo\\bar', true],
68
            ['..\\foo', false],
69
        ];
70
    }
71
}
72