@@ -9,12 +9,16 @@ class ResourceInspectorSpec extends ObjectBehavior
9
9
{
10
10
/**
11
11
* @param PhpSpec\Locator\PSR0\PSR0Resource $resource
12
+ * @param PhpSpec\Locator\PSR0\PSR0Resource $resource2
12
13
* @param Knp\PhpSpec\WellDone\Util\Filesystem $filesystem
13
14
**/
14
- function let ($ resource , $ filesystem )
15
+ function let ($ resource , $ resource2 , $ filesystem )
15
16
{
16
17
$ resource ->getSpecFilename ()->willReturn ('spec/The/Path.php ' );
17
18
$ resource ->getSrcFilename ()->willReturn ('src/The/Path.php ' );
19
+ $ resource ->getSrcClassname ()->willReturn ('The\Path ' );
20
+
21
+ $ resource2 ->getSrcClassname ()->willReturn ('The\PathType ' );
18
22
19
23
$ this ->beConstructedWith ($ filesystem );
20
24
}
@@ -78,4 +82,30 @@ function it_should_detect_if_resource_is_not_abstract($resource, $filesystem)
78
82
79
83
$ this ->isAbstract ($ resource )->shouldReturn (false );
80
84
}
85
+
86
+ public function it_should_test_query_matching ($ resource )
87
+ {
88
+ $ this ->matchQuery ($ resource , '*Path ' )->shouldReturn (true );
89
+ $ this ->matchQuery ($ resource , 'The\* ' )->shouldReturn (true );
90
+ $ this ->matchQuery ($ resource , '*Pa* ' )->shouldReturn (true );
91
+ }
92
+
93
+ public function it_should_test_query_not_matching ($ resource )
94
+ {
95
+ $ this ->matchQuery ($ resource , 'Path ' )->shouldReturn (false );
96
+ $ this ->matchQuery ($ resource , 'The/ ' )->shouldReturn (false );
97
+ $ this ->matchQuery ($ resource , '*path ' )->shouldReturn (false );
98
+ }
99
+
100
+ public function it_should_test_queries_matching ($ resource2 )
101
+ {
102
+ $ this ->matchQueries ($ resource2 , '*Type, App\*, *Controller ' )->shouldReturn (true );
103
+ $ this ->matchQueries ($ resource2 , '*Type, The\*, *Controller ' )->shouldReturn (true );
104
+ $ this ->matchQueries ($ resource2 , '*Type, The\*, *Path* ' )->shouldReturn (true );
105
+ }
106
+
107
+ public function it_should_test_queries_not_matching ($ resource2 )
108
+ {
109
+ $ this ->matchQueries ($ resource2 , '*Top, App\*, *Controller ' )->shouldReturn (false );
110
+ }
81
111
}
0 commit comments