Exemple #1
0
    /**
     * Ensures that inlinkDataSearch() works as expected given 'http://framework.zend.com/' as a query
     *
     * @return void
     */
    public function testInlinkDataSearchPhp()
    {
        $inlinkDataResultSet = $this->_yahoo->inlinkDataSearch('http://framework.zend.com/');

        $this->assertTrue($inlinkDataResultSet instanceof Zend_Service_Yahoo_InlinkDataResultSet);
        $this->assertTrue($inlinkDataResultSet->totalResultsAvailable > 10);
        $this->assertEquals(50, $inlinkDataResultSet->totalResultsReturned);
        $this->assertEquals(50, $inlinkDataResultSet->totalResults());
        $this->assertEquals(1, $inlinkDataResultSet->firstResultPosition);
        $this->assertEquals(0, $inlinkDataResultSet->key());

        try {
            $inlinkDataResultSet->seek(-1);
            $this->fail('Expected OutOfBoundsException not thrown');
        } catch (OutOfBoundsException $e) {
            $this->assertContains('Illegal index', $e->getMessage());
        }

        foreach ($inlinkDataResultSet as $inlinkDataResult) {
            $this->assertTrue($inlinkDataResult instanceof Zend_Service_Yahoo_InlinkDataResult);
        }

        $this->assertEquals(50, $inlinkDataResultSet->key());
        $inlinkDataResultSet->seek(0);
        $this->assertEquals(0, $inlinkDataResultSet->key());
    }
Exemple #2
0
 /**
  * Ensures that inlinkDataSearch() throws an exception when the omit_inlinks option is invalid
  *
  * @return void
  */
 public function testInlinkDataSearchExceptionOmitLinksInvalid()
 {
     try {
         $this->_yahoo->inlinkDataSearch('http://framework.zend.com/', array('omit_inlinks' => 'oops'));
         $this->fail('Expected Zend_Service_Exception not thrown');
     } catch (Zend_Service_Exception $e) {
         $this->assertContains("option 'omit_inlinks'", $e->getMessage());
     }
 }