You are here

public function ShareaholicSeqShareCountsTest::testRedditCountCallback in Share Buttons, Related Posts, Content Analytics - Shareaholic 8

Same name and namespace in other branches
  1. 7.3 lib/social-share-counts/seq_share_count_test.php \ShareaholicSeqShareCountsTest::testRedditCountCallback()

File

lib/social-share-counts/seq_share_count_test.php, line 132

Class

ShareaholicSeqShareCountsTest

Code

public function testRedditCountCallback() {

  // given a typical reddit counts api response, test that
  // it gives back the expected result (the ups which is 1)
  // NOTE: the actual JSON output was too long so some keys were removed
  $body = '{"kind": "Listing", "data": {"modhash": "", "children": [{"kind": "t3", "data": {"domain": "reddit.com", "banned_by": null, "likes": null, "clicked": false, "stickied": false, "score": 1, "downs": 0, "url": "http://reddit.com", "ups": 1, "num_comments": 0, "distinguished": null}}], "after": null, "before": null}}';
  $this->response['body'] = $body;
  $count = $this->share_count
    ->reddit_count_callback($this->response);
  $this
    ->assertEquals(1, $count, 'It should get the correct reddit count');
}