public function testOwnerWithAccessAllMentions() { $builders = $this->buildData(); $this->simulateLogin('*****@*****.**'); $_GET['u'] = 'someuser1'; $_GET['n'] = 'twitter'; $_GET['d'] = 'tweets-mostreplies'; $controller = new GridController(true); $this->assertTrue(isset($controller)); ob_start(); $controller->control(); $results = ob_get_contents(); ob_end_clean(); $json = substr($results, 29, 210); $ob = json_decode($json); // @TODO Figure out why these assertions don't work // $this->assertEqual($ob->status, 'success'); // $this->assertEqual(count($ob->posts), 3); $this->assertPattern('/"status":"success"/', $results); }
public function testReplyToSearch() { $builders = $this->buildData(); $this->simulateLogin('*****@*****.**'); $_GET['u'] = 'someuser1'; $_GET['n'] = 'twitter'; $_GET['t'] = '10765432100123456781'; $controller = new GridController(true); $this->assertTrue(isset($controller)); ob_start(); $controller->control(); $results = ob_get_contents(); ob_end_clean(); $json = substr($results, 29, strrpos($results, ';') - 30); $ob = json_decode($json); $this->assertEqual($ob->status, 'success'); $this->assertEqual(count($ob->posts), 2); $this->assertEqual($ob->posts[0]->text, 'Reply to a post'); $this->assertEqual($ob->posts[0]->post_id_str, '10765432100123456783_str'); }
public function testReplyToSearchNotLoggedIn() { $builders = $this->buildData(); //$this->simulateLogin('*****@*****.**'); $_GET['u'] = 'someuser1'; $_GET['n'] = 'twitter'; $_GET['t'] = '10765432100123456781'; // a private instance $controller = new GridController(true); try { $controller->control(); $this->fail("should throw auth exception"); } catch (Exception $e) { $this->assertPattern('/You must.*log in/', $e->getMessage()); } // public instance, but protected posts $builders = null; $public = 1; $builders = $this->buildData($public); $this->assertTrue(isset($controller)); ob_start(); $controller->go(); $results = ob_get_contents(); ob_end_clean(); $json = substr($results, 29, strrpos($results, ';') - 30); $ob = json_decode($json); $this->assertEqual($ob->status, 'success'); $this->assertEqual(count($ob->posts), 1); // public instance, and not protected posts $builders = null; $public = 1; $protected = 0; $builders = $this->buildData($public, $protected); $this->assertTrue(isset($controller)); ob_start(); $controller->go(); $results = ob_get_contents(); ob_end_clean(); $json = substr($results, 29, strrpos($results, ';') - 30); $ob = json_decode($json); $this->assertEqual($ob->status, 'success'); $this->assertEqual(count($ob->posts), 2); $this->assertEqual($ob->posts[0]->text, 'Reply to a post'); $this->assertEqual($ob->posts[0]->post_id_str, '10765432100123456783_str'); }