File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change 11
11
12
12
class SimpleFactory implements Factory
13
13
{
14
+ private $ parser ;
15
+
14
16
public function createMatcher () : Matcher
15
17
{
16
18
return new Matcher ($ this ->buildMatchers ());
@@ -39,7 +41,8 @@ protected function buildOrMatcher() : Matcher\ChainMatcher
39
41
$ arrayMatcher = new Matcher \ArrayMatcher (
40
42
new Matcher \ChainMatcher ([
41
43
$ orMatcher ,
42
- $ scalarMatchers
44
+ $ scalarMatchers ,
45
+ new Matcher \TextMatcher ($ scalarMatchers , $ this ->buildParser ())
43
46
]),
44
47
$ this ->buildParser ()
45
48
);
@@ -76,6 +79,12 @@ protected function buildScalarMatchers() : Matcher\ChainMatcher
76
79
77
80
protected function buildParser () : Parser
78
81
{
79
- return new Parser (new Lexer (), new Parser \ExpanderInitializer ());
82
+ if ($ this ->parser ) {
83
+ return $ this ->parser ;
84
+ }
85
+
86
+ $ this ->parser = new Parser (new Lexer (), new Parser \ExpanderInitializer ());
87
+
88
+ return $ this ->parser ;
80
89
}
81
90
}
Original file line number Diff line number Diff line change @@ -131,6 +131,16 @@ public function jsonDataProvider()
131
131
"nextPage": "@string@"
132
132
} ' ,
133
133
],
134
+ 'matches json values with full text matcher ' => [
135
+ /** @lang JSON */
136
+ '{
137
+ "url": "/accounts/9a7dae2d-d135-4bd7-b202-b3e7e91aaecd"
138
+ } ' ,
139
+ /** @lang JSON */
140
+ '{
141
+ "url": "/accounts/@uuid@"
142
+ } ' ,
143
+ ],
134
144
'matches none elements - empty array ' => [
135
145
/** @lang JSON */
136
146
'{
You can’t perform that action at this time.
0 commit comments