@@ -43,6 +43,34 @@ public function testStagedTrueType(): void
43
43
$ this ->assertTrue ($ thatIs ->isTrue ($ io , $ repo ));
44
44
}
45
45
46
+ /**
47
+ * Tests ThatIs::isTrue
48
+ */
49
+ public function testStagedTrueMultipleType (): void
50
+ {
51
+ $ io = $ this ->createIOMock ();
52
+ $ repo = $ this ->createRepositoryMock ();
53
+ $ index = $ this ->createGitIndexOperator (['foo.php ' , 'bar.php ' ]);
54
+ $ repo ->expects ($ this ->once ())->method ('getIndexOperator ' )->willReturn ($ index );
55
+
56
+ $ thatIs = new ThatIs (['ofType ' => ['php ' , 'js ' ]]);
57
+ $ this ->assertTrue ($ thatIs ->isTrue ($ io , $ repo ));
58
+ }
59
+
60
+ /**
61
+ * Tests ThatIs::isTrue
62
+ */
63
+ public function testStagedFalseMultipleType (): void
64
+ {
65
+ $ io = $ this ->createIOMock ();
66
+ $ repo = $ this ->createRepositoryMock ();
67
+ $ index = $ this ->createGitIndexOperator (['foo.php ' , 'bar.php ' ]);
68
+ $ repo ->expects ($ this ->once ())->method ('getIndexOperator ' )->willReturn ($ index );
69
+
70
+ $ thatIs = new ThatIs (['ofType ' => ['ts ' , 'js ' ]]);
71
+ $ this ->assertFalse ($ thatIs ->isTrue ($ io , $ repo ));
72
+ }
73
+
46
74
/**
47
75
* Tests ThatIs::isTrue
48
76
*/
@@ -57,6 +85,48 @@ public function testStagedTrueDirectory(): void
57
85
$ this ->assertTrue ($ thatIs ->isTrue ($ io , $ repo ));
58
86
}
59
87
88
+ /**
89
+ * Tests ThatIs::isTrue
90
+ */
91
+ public function testStagedFalsePartialDirectory (): void
92
+ {
93
+ $ io = $ this ->createIOMock ();
94
+ $ repo = $ this ->createRepositoryMock ();
95
+ $ index = $ this ->createGitIndexOperator (['foo/foo.php ' , 'foo/bar/bar.js ' , 'fiz/baz.txt ' ]);
96
+ $ repo ->expects ($ this ->once ())->method ('getIndexOperator ' )->willReturn ($ index );
97
+
98
+ $ thatIs = new ThatIs (['inDirectory ' => 'bar/ ' ]);
99
+ $ this ->assertFalse ($ thatIs ->isTrue ($ io , $ repo ));
100
+ }
101
+
102
+ /**
103
+ * Tests ThatIs::isTrue
104
+ */
105
+ public function testStagedTrueMultipleDirectory (): void
106
+ {
107
+ $ io = $ this ->createIOMock ();
108
+ $ repo = $ this ->createRepositoryMock ();
109
+ $ index = $ this ->createGitIndexOperator (['foo/foo.php ' , 'bar/bar.js ' , 'fiz/baz.txt ' ]);
110
+ $ repo ->expects ($ this ->once ())->method ('getIndexOperator ' )->willReturn ($ index );
111
+
112
+ $ thatIs = new ThatIs (['inDirectory ' => ['bar/ ' , 'baz/ ' ]]);
113
+ $ this ->assertTrue ($ thatIs ->isTrue ($ io , $ repo ));
114
+ }
115
+
116
+ /**
117
+ * Tests ThatIs::isTrue
118
+ */
119
+ public function testStagedFalseMultipleDirectory (): void
120
+ {
121
+ $ io = $ this ->createIOMock ();
122
+ $ repo = $ this ->createRepositoryMock ();
123
+ $ index = $ this ->createGitIndexOperator (['foo/foo.php ' , 'bar/bar.js ' , 'fiz/baz.txt ' ]);
124
+ $ repo ->expects ($ this ->once ())->method ('getIndexOperator ' )->willReturn ($ index );
125
+
126
+ $ thatIs = new ThatIs (['inDirectory ' => ['foobar/ ' , 'baz/ ' ]]);
127
+ $ this ->assertFalse ($ thatIs ->isTrue ($ io , $ repo ));
128
+ }
129
+
60
130
/**
61
131
* Tests ThatIs::isTrue
62
132
*/
0 commit comments