File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,6 @@ public function isSatisfiedBy(array $value)
4545 {
4646 if (isset ($ value ['dirname ' ])) {
4747 $ path = $ this ->cleanPath ((string ) $ this ->path );
48-
4948 $ validChars = '[a-zA-Z0-9 \\\/\.\<\>\,\|\:\(\)\&\;\#] ' ;
5049
5150 $ pattern = '(^(?!\/) '
@@ -69,6 +68,10 @@ public function isSatisfiedBy(array $value)
6968 */
7069 private function cleanPath ($ path )
7170 {
71+ if ($ path === '. ' || $ path === './ ' ) {
72+ return '' ;
73+ }
74+
7275 if (substr ($ path , 0 , 2 ) === './ ' ) {
7376 $ path = substr ($ path , 1 );
7477 }
Original file line number Diff line number Diff line change @@ -44,6 +44,32 @@ public function testIfSpecificationIsSatisfied($dirname)
4444 $ this ->assertTrue ($ this ->fixture ->isSatisfiedBy (['dirname ' => $ dirname ]));
4545 }
4646
47+ /**
48+ * @covers ::__construct
49+ * @covers ::isSatisfiedBy
50+ * @covers ::<private>
51+ * @dataProvider validDirnames
52+ * @uses Flyfinder\Path
53+ */
54+ public function testWithSingleDotSpec ($ dirname )
55+ {
56+ $ spec = new InPath (new Path ('. ' ));
57+ $ this ->assertTrue ($ spec ->isSatisfiedBy (['dirname ' => $ dirname ]));
58+ }
59+
60+ /**
61+ * @covers ::__construct
62+ * @covers ::isSatisfiedBy
63+ * @covers ::<private>
64+ * @dataProvider validDirnames
65+ * @uses Flyfinder\Path
66+ */
67+ public function testWithCurrentDirSpec ($ dirname )
68+ {
69+ $ spec = new InPath (new Path ('./ ' ));
70+ $ this ->assertTrue ($ spec ->isSatisfiedBy (['dirname ' => $ dirname ]));
71+ }
72+
4773 /**
4874 * Data provider for testIfSpecificationIsSatisfied. Contains a few valid directory names
4975 *
You can’t perform that action at this time.
0 commit comments