From 1e4dd5d09fe11155f3a310e969fac8db2fdfcb02 Mon Sep 17 00:00:00 2001 From: dieterve Date: Fri, 21 Aug 2015 15:27:29 +0200 Subject: [PATCH] FragmentParser: add test for custom fragments. --- tests/Parsers/FragmentParserTest.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/Parsers/FragmentParserTest.php b/tests/Parsers/FragmentParserTest.php index eb7898e..59664c9 100644 --- a/tests/Parsers/FragmentParserTest.php +++ b/tests/Parsers/FragmentParserTest.php @@ -113,4 +113,26 @@ public function testParsingAndMergingWithParent() $this->assertEquals($expectedBody, $parser->parse($body)); } + + public function testParsingCustomFragments() + { + $parser = new FragmentParser(); + + $body = [ + 'query' => [ + new IDFilter(123), + ] + ]; + $expectedBody = [ + 'query' => [ + [ + 'term' => [ + 'id' => 123 + ] + ] + ] + ]; + + $this->assertEquals($expectedBody, $parser->parse($body)); + } }