Patch by Jacky Chao Wang, Fixes a couple of test errors in:
[shindig.git] / php / test / social / RestFulCollectionTest.php
blob8fc7f2f5d657f95622c1ce4d6b6ec5b4cdcbed86
1 <?php
2 /**
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
18 * under the License.
21 /**
22 * RestFulCollection test case.
24 class RestFulCollectionTest extends PHPUnit_Framework_TestCase {
26 /**
27 * @var RestFulCollection
29 private $RestFulCollection;
31 /**
32 * Prepares the environment before running a test.
34 protected function setUp() {
35 parent::setUp();
36 $entry = array('Entry');
37 $this->RestFulCollection = new RestfulCollection($entry, 1, 1);
40 /**
41 * Cleans up the environment after running a test.
43 protected function tearDown() {
44 $this->RestFulCollection = null;
45 parent::tearDown();
48 /**
49 * Constructs the test case.
51 public function __construct() {}
53 /**
54 * Tests RestFulCollection->__construct()
56 public function test__construct() {
57 $entry = array('Entry');
58 $this->RestFulCollection->__construct($entry, 1, 1);
61 /**
62 * Tests RestFulCollection->getEntry()
64 public function testGetEntry() {
65 $entry = array('Entry');
66 $this->RestFulCollection->setEntry($entry);
67 $this->assertEquals($entry, $this->RestFulCollection->getEntry());
70 /**
71 * Tests RestFulCollection->getStartIndex()
73 public function testGetStartIndex() {
74 $this->RestFulCollection->setStartIndex(1);
75 $this->assertEquals(1, $this->RestFulCollection->getStartIndex());
78 /**
79 * Tests RestFulCollection->getTotalResults()
81 public function testGetTotalResults() {
82 $this->RestFulCollection->setTotalResults(1);
83 $this->assertEquals(1, $this->RestFulCollection->getTotalResults());
86 /**
87 * Tests RestFulCollection->createFromEntry()
89 public function testCreateFromEntry() {
90 $entry = array('Entry');
91 $restFulCollection = RestFulCollection::createFromEntry($entry);
92 $this->assertEquals(1, $restFulCollection->getTotalResults());
93 $this->assertEquals($entry, $restFulCollection->getEntry());
94 $this->assertEquals(0, $restFulCollection->getStartIndex());