/** * @expectedException Traackr\InvalidCustomerKeyException */ public function testSTagListInvalidCustomerKey() { Traackr\TraackrApi::setCustomerKey('xxxRandomInvalidCustomerKeyxxxx'); Traackr\AccountMgmt::tagList(); }
public function tearDown() { Traackr\TraackrApi::setCustomerKey($this->savedCustomerKey); }
/** * @group read-only */ public function testLookupTwitter() { $twitterHandle = 'dchancogne'; $inf = Traackr\Influencers::lookupTwitter($twitterHandle); // Check result is there $this->assertArrayHasKey('influencer', $inf, 'No influencer found'); $this->assertArrayHasKey($twitterHandle, $inf['influencer'], 'Invalid influencer found'); // Check appropriate fields are present $this->assertArrayHasKey('uid', $inf['influencer'][$twitterHandle], 'UID filed is missing'); $this->assertArrayHasKey('name', $inf['influencer'][$twitterHandle], 'Name field missing'); $this->assertArrayHasKey('description', $inf['influencer'][$twitterHandle], 'Description field missing'); $this->assertArrayHasKey('title', $inf['influencer'][$twitterHandle], 'Title field missing'); $this->assertArrayHasKey('location', $inf['influencer'][$twitterHandle], 'Location field missing'); $this->assertArrayHasKey('avatar', $inf['influencer'][$twitterHandle], 'Avatar field missing'); $this->assertArrayHasKey('reach', $inf['influencer'][$twitterHandle], 'Reach field missing'); $this->assertArrayHasKey('resonance', $inf['influencer'][$twitterHandle], 'Resonance field missing'); $this->assertArrayNotHasKey('channels', $inf['influencer'][$twitterHandle], 'Channels should not have be returned'); $this->assertArrayNotHasKey('tags', $inf['influencer'][$twitterHandle], 'Tags field missing'); // Check some values $this->assertEquals($this->infUid, $inf['influencer'][$twitterHandle]['uid'], 'Incorrect UID'); $this->assertEquals($this->infName, $inf['influencer'][$twitterHandle]['name'], 'Incorrect name'); // NOTE // Disable customer key so that 'show' doe not return tags b/c lookupTwitter doesn't currently Traackr\TraackrApi::setCustomerKey(''); $inf = Traackr\Influencers::show($this->infUid); $twitter = Traackr\Influencers::lookupTwitter('dchancogne'); $this->assertJsonStringEqualsJsonString(json_encode($inf['influencer'][$this->infUid]), json_encode($twitter['influencer']['dchancogne'])); }