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 1111
1212class SimpleFactory implements Factory
1313{
14+ private $ parser ;
15+
1416 public function createMatcher () : Matcher
1517 {
1618 return new Matcher ($ this ->buildMatchers ());
@@ -39,7 +41,8 @@ protected function buildOrMatcher() : Matcher\ChainMatcher
3941 $ arrayMatcher = new Matcher \ArrayMatcher (
4042 new Matcher \ChainMatcher ([
4143 $ orMatcher ,
42- $ scalarMatchers
44+ $ scalarMatchers ,
45+ new Matcher \TextMatcher ($ scalarMatchers , $ this ->buildParser ())
4346 ]),
4447 $ this ->buildParser ()
4548 );
@@ -76,6 +79,12 @@ protected function buildScalarMatchers() : Matcher\ChainMatcher
7679
7780 protected function buildParser () : Parser
7881 {
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 ;
8089 }
8190}
Original file line number Diff line number Diff line change @@ -131,6 +131,16 @@ public function jsonDataProvider()
131131 "nextPage": "@string@"
132132 } ' ,
133133 ],
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+ ],
134144 'matches none elements - empty array ' => [
135145 /** @lang JSON */
136146 '{
You can’t perform that action at this time.
0 commit comments