FileMatcher::isExist()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace PHPKitchen\CodeSpecsCore\Expectation\Matcher;
4
5
use PHPKitchen\CodeSpecsCore\Expectation\Matcher\Base\Matcher;
6
use PHPKitchen\CodeSpecsCore\Expectation\Mixin\FileStateExpectations;
7
8
/**
9
 * FileMatcher is designed to check given file matches expectation.
10
 *
11
 * @package PHPKitchen\CodeSpecsCore\Expectation
12
 * @author Dmitry Kolodko <[email protected]>
13
 */
14
class FileMatcher extends Matcher {
15
    use FileStateExpectations;
16
17
    /**
18
     * @return $this
19
     */
20
    public function isExist(): self {
21
        $this->startStep('is exist')
22
            ->assertFileExists();
23
        return $this;
24
    }
25
26
    /**
27
     * @return $this
28
     */
29
    public function isNotExist(): self {
30
        $this->startStep('is not exist')
31
            ->assertFileNotExists();
32
        return $this;
33
    }
34
35
    /**
36
     * @return $this
37
     */
38
    public function isEqualTo($file): self {
39
        $this->startStep('is equal to file "' . $file . '"')
40
            ->assertFileEquals($file);
41
        return $this;
42
    }
43
44
    /**
45
     * @return $this
46
     */
47
    public function isNotEqualTo($file): self {
48
        $this->startStep('is not equal to file "' . $file . '"')
49
            ->assertFileNotEquals($file);
50
        return $this;
51
    }
52
53
    /**
54
     * @return $this
55
     */
56
    public function isEqualToJsonFile($file): self {
57
        $this->startStep('is equal to json file "' . $file . '"')
58
            ->assertJsonFileEqualsJsonFile($file);
59
        return $this;
60
    }
61
62
    /**
63
     * @return $this
64
     */
65
    public function isNotEqualToJsonFile($file): self {
66
        $this->startStep('is not equal to json file "' . $file . '"')
67
            ->assertJsonFileNotEqualsJsonFile($file);
68
        return $this;
69
    }
70
71
    /**
72
     * @return $this
73
     */
74
    public function isEqualToXmlFile($file): self {
75
        $this->startStep('is equal to xml file "' . $file . '"')
76
            ->assertXmlFileEqualsXmlFile($file);
77
        return $this;
78
    }
79
80
    /**
81
     * @return $this
82
     */
83
    public function isNotEqualToXmlFile($file): self {
84
        $this->startStep('is not equal to xml file "' . $file . '"')
85
            ->assertXmlFileNotEqualsXmlFile($file);
86
        return $this;
87
    }
88
}