/** * @dataProvider queryOptionsProvider */ public function testSerializeQueryOptions(QueryOptions $options) { $sortExpressionSerializer = new SortExpressionSerializer(); $serializer = new QueryOptionsSerializer($sortExpressionSerializer); $actualSerialization = $serializer->serialize($options); $expectedSerialization = array('objectType' => 'queryOptions', 'limit' => $options->getLimit(), 'offset' => $options->getOffset(), 'sort' => array('expressions' => array_map(function (SortExpression $expression) use($sortExpressionSerializer) { return $sortExpressionSerializer->serialize($expression); }, $options->getSort()->getExpressions()))); $this->assertEquals($expectedSerialization, $actualSerialization); }
/** * @dataProvider sortExpressionProvider */ public function testSerializeSortExpression(SortExpression $expression, $expectedSerialization) { $serializer = new SortExpressionSerializer(); $actualSerialization = $serializer->serialize($expression); $this->assertEquals($expectedSerialization, $actualSerialization); }