ref = new ReflectionClass('Zend_Service_Technorati_ResultSet'); $this->dom = self::getTestFileContentAsDom('TestSearchResultSet.xml'); $this->object = new Zend_Service_Technorati_SearchResultSet($this->dom); $this->objectRef = new ReflectionObject($this->object); } public function testResultSetIsAbstract() { $this->assertTrue($this->ref->isAbstract()); } public function testResultSetImplementsSeekableIteratorInterface() { $this->assertTrue($this->ref->isIterateable()); } /** * Security check */ public function testResultSetIsParentOfThisObjectClass() { $this->assertTrue($this->objectRef->isSubclassOf($this->ref)); } public function testResultSetSeek() { $this->assertEquals(0, $this->object->key()); $this->object->seek(2); $this->assertEquals(2, $this->object->key()); } public function testResultSetSeekThrowsOutOfBoundsExceptionWithInvalidIndex() { try { $this->object->seek(1000); $this->fail('Expected OutOfBoundsException not thrown'); } catch (OutOfBoundsException $e) { $this->assertContains('Illegal index', $e->getMessage()); } } public function testResultSetKey() { $this->assertEquals(0, $this->object->key()); $this->object->seek(2); $this->assertEquals(2, $this->object->key()); // don't move forward $this->assertEquals(2, $this->object->key()); } public function testResultSetNext() { $this->assertEquals(0, $this->object->key()); $this->object->next(); $this->assertEquals(1, $this->object->key()); } public function testResultSetRewind() { $this->assertEquals(0, $this->object->key()); $this->object->seek(2); $this->assertTrue($this->object->rewind()); $this->assertEquals(0, $this->object->key()); } public function testResultSetSerialization() { $this->_testResultSetSerialization($this->object); } }