Ejemplo n.º 1
0
 public function testSearchFollowers()
 {
     $this->simulateLogin('*****@*****.**', true, true);
     $_GET['c'] = "followers";
     $_GET['u'] = 'ev';
     $_GET['n'] = 'twitter';
     $_GET['q'] = "name:Apple";
     $controller = new SearchController(true);
     $this->assertTrue(isset($controller));
     $results = $controller->go();
     $this->assertPattern('/No followers found/', $results);
 }
Ejemplo n.º 2
0
 public function testSearchFollowersLessThan20Results()
 {
     $builders = self::buildData();
     $builders[] = FixtureBuilder::build('users', array('user_id' => '15', 'user_name' => 'jonyive', 'full_name' => 'Jony Ive', 'description' => 'design things at Apple'));
     $builders[] = FixtureBuilder::build('follows', array('follower_id' => '15', 'user_id' => '13', 'network' => 'twitter'));
     $this->simulateLogin('*****@*****.**', true, true);
     $_GET['q'] = "Apple";
     $controller = new SearchController(true);
     $this->assertTrue(isset($controller));
     $results = $controller->go();
     $this->assertPattern("/Results seem incomplete\\? ThinkUp may not have captured your latest data./", $results);
     $this->assertNoPattern("/Aw, no \"Apple\" here\\!/", $results);
     $this->assertNoPattern("/Seems like none of @ev's Twitter followers has \"Apple\" in their bio./", $results);
     $this->assertPattern("/1 of @ev's Twitter followers has \"Apple\" in their bio/", $results);
     $this->debug($results);
 }
Ejemplo n.º 3
0
/**
 *
 * ThinkUp/webapp/search.php
 *
 * Copyright (c) 2013 Gina Trapani
 *
 * LICENSE:
 *
 * This file is part of ThinkUp (http://thinkup.com).
 *
 * ThinkUp is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any
 * later version.
 *
 * ThinkUp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with ThinkUp.  If not, see
 * <http://www.gnu.org/licenses/>.
 *
 *
 * @author Gina Trapani <ginatrapani[at]gmail[dot]com>
 * @license http://www.gnu.org/licenses/gpl.html
 * @copyright 2013 Gina Trapani
 */
require_once 'init.php';
$controller = new SearchController();
echo $controller->go();
Ejemplo n.º 4
0
 public function testSearchSearches()
 {
     //Before building data No posts
     $this->simulateLogin('*****@*****.**', true, true);
     $_GET['c'] = "searches";
     $_GET['n'] = "twitter";
     $_GET['u'] = "ecucurella";
     $controller = new SearchController(true);
     $this->assertTrue(isset($controller));
     $results = $controller->go();
     $this->assertPattern('/No posts found/', $results);
     $this->assertNoPattern('/Whoops! That user doesn&#39;t exist. Please try again./', $results);
     $this->assertNoPattern('/Uh-oh. #totssomtv3 is not a saved search. Please try again./', $results);
     $this->assertNoPattern('/Whoops! You don&#39;t have access to that user. Please try again./', $results);
     $this->assertPattern('/Uh-oh. Your search terms are missing. Please try again./', $results);
     $_GET['q'] = "";
     $controller = new SearchController(true);
     $this->assertTrue(isset($controller));
     $results = $controller->go();
     $this->assertPattern('/No posts found/', $results);
     $this->assertNoPattern('/Whoops! That user doesn&#39;t exist. Please try again./', $results);
     $this->assertNoPattern('/Uh-oh. #totssomtv3 is not a saved search. Please try again./', $results);
     $this->assertNoPattern('/Whoops! You don&#39;t have access to that user. Please try again./', $results);
     $this->assertPattern('/Uh-oh. Your search term is missing. Please try again./', $results);
     $_GET['q'] = "totssomtv3";
     $controller = new SearchController(true);
     $this->assertTrue(isset($controller));
     $results = $controller->go();
     $this->assertPattern('/No posts found/', $results);
     $this->assertPattern('/Whoops! That user doesn&#39;t exist. Please try again./', $results);
     $this->assertNoPattern('/Uh-oh. #totssomtv3 is not a saved search. Please try again./', $results);
     $this->assertNoPattern('/Whoops! You don&#39;t have access to that user. Please try again./', $results);
     $_GET['u'] = "vetcastellnou";
     $_GET['q'] = "CCMA";
     $controller = new SearchController(true);
     $this->assertTrue(isset($controller));
     $results = $controller->go();
     $this->assertPattern('/No posts found/', $results);
     $this->assertPattern('/Whoops! That user doesn&#39;t exist. Please try again./', $results);
     $this->assertNoPattern('/Uh-oh. CCMA is not a saved search. Please try again./', $results);
     $this->assertNoPattern('/Whoops! You don&#39;t have access to that user. Please try again./', $results);
     //Buil data
     $builder = $this->buildSearchData1();
     //Hashtag NOT being searched
     $_GET['u'] = "ecucurella";
     $_GET['k'] = "#nohashtag";
     $_GET['q'] = "#nohashtag";
     $controller = new SearchController(true);
     $this->assertTrue(isset($controller));
     $results = $controller->go();
     $this->debug($results);
     $this->assertPattern('/No posts found/', $results);
     $this->assertNoPattern('/Whoops! That user doesn&#39;t exist. Please try again./', $results);
     $this->assertPattern('/Uh-oh. #nohashtag is not a saved search. Please try again./', $results);
     $this->assertNoPattern('/Whoops! You don&#39;t have access to that user. Please try again./', $results);
     //Keyword NOT being searched
     $_GET['u'] = 'vetcastellnou';
     $_GET['q'] = "nokeyword";
     $_GET['k'] = "nokeyword";
     $controller = new SearchController(true);
     $this->assertTrue(isset($controller));
     $results = $controller->go();
     $this->assertPattern('/No posts found/', $results);
     $this->assertNoPattern('/Whoops! That user doesn&#39;t exist. Please try again./', $results);
     $this->assertPattern('/Uh-oh. nokeyword is not a saved search. Please try again./', $results);
     $this->assertNoPattern('/Whoops! You don&#39;t have access to that user. Please try again./', $results);
     //Hashtag being searched
     $_GET['u'] = "ecucurella";
     $_GET['q'] = "#totssomtv3";
     $_GET['k'] = "#totssomtv3";
     $controller = new SearchController(true);
     $this->assertTrue(isset($controller));
     $results = $controller->go();
     $this->debug($results);
     $this->assertNoPattern('/No posts found/', $results);
     $this->assertNoPattern('/Whoops! That user doesn&#39;t exist. Please try again./', $results);
     $this->assertNoPattern('/Uh-oh. #totssomtv3 is not a saved search. Please try again./', $results);
     $this->assertPattern('/Dem treballadors de TV3 donarem sang #lasangdelatele #totssomtv3/', $results);
     $this->assertNoPattern('/El comit dempresa de TV3 acusa la direcci de la CCMA de populista/', $results);
     $this->assertNoPattern('/El Chelsea quiere a Mourinho YA #efectivament/', $results);
     $this->assertNoPattern('/Whoops! You don&#39;t have access to that user. Please try again./', $results);
     //Keyword being searched
     $_GET['u'] = 'vetcastellnou';
     $_GET['q'] = "CCMA";
     $_GET['k'] = "CCMA";
     $controller = new SearchController(true);
     $this->assertTrue(isset($controller));
     $results = $controller->go();
     $this->debug($results);
     $this->assertNoPattern('/No posts found/', $results);
     $this->assertNoPattern('/Whoops! That user doesn&#39;t exist. Please try again./', $results);
     $this->assertNoPattern('/Uh-oh. Keyword CCMA is not being searched. Please try again./', $results);
     $this->assertNoPattern('/Dem treballadors de TV3 donarem sang #lasangdelatele #totssomtv3/', $results);
     $this->assertPattern('/El comit dempresa de TV3 acusa la direcci de la CCMA de populista/', $results);
     $this->assertNoPattern('/El Chelsea quiere a Mourinho YA #efectivament/', $results);
     $this->assertNoPattern('/Whoops! You don&#39;t have access to that user. Please try again./', $results);
     //Another owner with no permission
     $this->simulateLogin('*****@*****.**', true, true);
     //Hashtag being searched
     $_GET['u'] = "ecucurella";
     $_GET['q'] = "totssomtv3";
     $controller = new SearchController(true);
     $this->assertTrue(isset($controller));
     $results = $controller->go();
     $this->assertPattern('/No posts found/', $results);
     $this->assertNoPattern('/Whoops! That user doesn&#39;t exist. Please try again./', $results);
     $this->assertNoPattern('/Uh-oh. Hashtag #totssomtv3 is not being searched. Please try again./', $results);
     $this->assertPattern('/Whoops! You don&#39;t have access to that user. Please try again./', $results);
     //Keyword being searched
     $_GET['u'] = 'vetcastellnou';
     $_GET['q'] = "CCMA";
     $controller = new SearchController(true);
     $this->assertTrue(isset($controller));
     $results = $controller->go();
     $this->assertPattern('/No posts found/', $results);
     $this->assertNoPattern('/Whoops! That user doesn&#39;t exist. Please try again./', $results);
     $this->assertNoPattern('/Uh-oh. Keyword CCMA is not being searched. Please try again./', $results);
     $this->assertPattern('/Whoops! You don&#39;t have access to that user. Please try again./', $results);
 }