3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
22 * OutputJsonConverter test case.
24 class OutputJsonConverterTest
extends PHPUnit_Framework_TestCase
{
27 * @var OutputJsonConverter
29 private $OutputJsonConverter;
32 * Prepares the environment before running a test.
34 protected function setUp() {
36 $this->OutputJsonConverter
= new OutputJsonConverter();
40 * Cleans up the environment after running a test.
42 protected function tearDown() {
43 $this->OutputJsonConverter
= null;
48 * Tests OutputJsonConverter->outputResponse()
50 public function testOutputResponse() {
51 $inputConverter = new InputJsonConverter();
52 $outputConverter = new OutputJsonConverter();
53 $servletRequest = array('url' => '/people/1/@self');
54 $requestItem = RestRequestItem
::createWithRequest($servletRequest, null, $inputConverter, $outputConverter);
55 $requestItem->applyUrlTemplate("/people/{userId}/{groupId}/{personId}");
57 'entry' => array('isOwner' => false, 'isViewer' => false, 'displayName' => '1 1',
59 $responseItem = new ResponseItem(null, null, $response);
61 $outputConverter->outputResponse($responseItem, $requestItem);
62 $output = ob_get_clean();
71 $this->assertEquals($expected, $output);