Skip to content

Commit

Permalink
#20 Added unit test to search and lookup influencers by email
Browse files Browse the repository at this point in the history
  • Loading branch information
KidA78 committed Aug 27, 2014
1 parent 020ec8e commit d868f42
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/Influencers/InfluencersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,15 @@ public function testLookupRO() {
$this->assertNotEmpty($inf['aggregations']['countryIsoCode']['buckets'], 'No country aggregations found');
$this->assertGreaterThan(0, $inf['aggregations']['countryIsoCode']['buckets'][0]['count'], 'There should be more than zero matches for the first country');

// Lookup By Email
$inf = Traackr\Influencers::search(array('keywords' => 'traackr', 'emails' => array('[email protected]', '[email protected]', '[email protected]')));
$this->assertGreaterThan(0, $inf['influencers'], 'No results found');
$this->assertEquals(2, count($inf['influencers']), 'Two results should have been found');

// Lookup By Email String
$inf = Traackr\Influencers::search(array('keywords' => 'traackr', 'emails' => '[email protected],[email protected],[email protected]'));
$this->assertGreaterThan(0, $inf['influencers'], 'No results found');
$this->assertEquals(2, count($inf['influencers']), 'Two results should have been found');

} // End function testLookup()

Expand Down Expand Up @@ -594,6 +603,15 @@ public function testSearchRO() {
$inf = Traackr\Influencers::search(array('keywords' => 'xxxaaaxxx'));
$this->assertCount(0, $inf['influencers'], 'Results found');

// Search Email
$inf = Traackr\Influencers::search(array('keywords' => 'traackr', 'emails' => array('[email protected]')));
$this->assertGreaterThan(0, $inf['influencers'], 'No results found');
$this->assertEquals('David Chancogne', $inf['influencers'][0]['name'], 'Name does not match expected result by email address: [email protected]');

// Search Email (Emails param is string, not array)
$inf = Traackr\Influencers::search(array('keywords' => 'traackr', 'emails' => '[email protected]'));
$this->assertGreaterThan(0, $inf['influencers'], 'No results found');
$this->assertEquals('David Chancogne', $inf['influencers'][0]['name'], 'Name does not match expected result by email address: [email protected]');
} // End function testSearchRO()


Expand Down

0 comments on commit d868f42

Please sign in to comment.