Completed
Push — master ( e09a05...0dc2bf )
by Sebastian
01:59
created

FileTest::testGetUnique()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
namespace SebastianFeldmann\Ftp;
3
4
use PHPUnit\Framework\TestCase;
0 ignored issues
show
Bug introduced by
The type PHPUnit\Framework\TestCase was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
5
6
class FileTest extends TestCase
7
{
8
    /**
9
     * Tests File::__construct
10
     *
11
     * @expectedException \Exception
12
     */
13
    public function testConstructNoType()
14
    {
15
        $file = new File([]);
0 ignored issues
show
Unused Code introduced by
The assignment to $file is dead and can be removed.
Loading history...
16
    }
17
18
    /**
19
     * Tests File::__construct
20
     *
21
     * @expectedException \Exception
22
     */
23
    public function testConstructNoName()
24
    {
25
        $file = new File(['type' => 'file']);
0 ignored issues
show
Unused Code introduced by
The assignment to $file is dead and can be removed.
Loading history...
26
    }
27
28
    /**
29
     * Tests File::__construct
30
     */
31
    public function testConstructNoMtime()
32
    {
33
        $file = new File(['type' => 'file', 'name' => 'foo.txt', 'size' => 100]);
34
        $date = $file->getLastModifyDate();
35
36
        $this->assertTrue(is_a($date, \DateTimeImmutable::class));
37
    }
38
39
    /**
40
     * Tests File::getUniqueName
41
     */
42
    public function testGetUnique()
43
    {
44
        $file = new File(['type' => 'file', 'name' => 'foo.txt', 'size' => 100, 'unique' => 'UN']);
45
        $this->assertEquals('UN', $file->getUniqueName());
46
    }
47
48
    /**
49
     * Tests File::isDir
50
     */
51
    public function testIsDir()
52
    {
53
        $file = new File(['type' => 'file', 'name' => 'foo.txt', 'size' => 100, 'unique' => 'UN']);
54
        $this->assertFalse($file->isDir());
55
        $this->assertTrue($file->isFile());
56
    }
57
58
    /**
59
     * Tests File::isDir
60
     */
61
    public function testIsFile()
62
    {
63
        $file = new File(['type' => 'dir', 'name' => 'foo.txt', 'size' => 100, 'unique' => 'UN']);
64
        $this->assertTrue($file->isDir());
65
        $this->assertFalse($file->isFile());
66
    }
67
}
68