Passed
Push — master ( af2957...e6274a )
by Sebastian
02:57
created

CheckTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 50
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A testIsRelativePathNotBeingAbsolute() 0 3 1
A providerWindowsPaths() 0 6 1
A testIsAbsolutePathStream() 0 3 1
A testIsAbsolutePathTrue() 0 3 1
A testIsAbsolutePathWindows() 0 3 1
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