Skip to content

Commit

Permalink
* Added three more tests.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.php.net/repository/pear/packages/Services_Yahoo/trunk@221121 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information
mj committed Oct 4, 2006
1 parent 1f7f055 commit 3816ccc
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions Yahoo/Tests/Search.php
Expand Up @@ -83,6 +83,16 @@ public function testWithResults20() {
$this->assertEquals(20, $result->getTotalResultsReturned());
}

public function testWithResultsBoundaries() {
$client = Services_Yahoo_Search::factory("web");

$result = $client->withResults(-1)->searchFor("Madonna");
$this->assertEquals(10, $result->getTotalResultsReturned());

$result = $client->withResults(51)->searchFor("Madonna");
$this->assertEquals(10, $result->getTotalResultsReturned());
}

public function testStartingAt() {
$client = Services_Yahoo_Search::factory("web");

Expand Down Expand Up @@ -126,4 +136,30 @@ public function testOnSites() {
$this->matchesRegularExpression("~^pecl\.php\.net~")));
}
}

public function testNewsSortedBy() {
$client = Services_Yahoo_Search::factory("news");

$results = $client->sortedBy("date")->searchFor("Madonna");

$lastDate = 0;
foreach ($results as $result) {
if ($lastDate == 0) {
$lastDate = $result['PublishDate'];
}

$this->assertTrue($result['PublishDate'] <= $lastDate);
$lastDate = $result['PublishDate'];
}
}

public function testNewsInLanguage() {
$client = Services_Yahoo_Search::factory("news");

$results = $client->inLanguage("sv")->searchFor("Madonna");

foreach ($results as $result) {
$this->assertEquals("sv", $result['Language']);
}
}
}

0 comments on commit 3816ccc

Please sign in to comment.