Ejemplo n.º 1
0
 public function testCrawlCompletion()
 {
     $this->debug(__METHOD__);
     $builders = array();
     //Add instances
     $instance_builder_1 = FixtureBuilder::build('instances', array('id' => 1, 'network_username' => 'julie', 'network' => 'twitter', 'crawler_last_run' => '-5d', 'is_activated' => '1', 'is_public' => '1'));
     $instance_builder_2 = FixtureBuilder::build('instances', array('id' => 2, 'network_username' => 'john', 'network' => 'twitter', 'crawler_last_run' => '-5d', 'is_activated' => '1', 'is_public' => '1'));
     $builders[] = FixtureBuilder::build('instances_twitter', array('id' => 1));
     $builders[] = FixtureBuilder::build('instances_twitter', array('id' => 2));
     //Add owner
     $builders[] = FixtureBuilder::build('owners', array('id' => 1, 'full_name' => 'ThinkUp J. User', 'email' => '*****@*****.**', 'is_activated' => 1, 'is_admin' => 1));
     $builders[] = FixtureBuilder::build('owner_instances', array('owner_id' => 1, 'instance_id' => 1, 'auth_error' => ''));
     $builders[] = FixtureBuilder::build('owner_instances', array('owner_id' => 1, 'instance_id' => 2, 'auth_error' => ''));
     $this->simulateLogin('*****@*****.**', true, true);
     $test = new TwitterInstanceMySQLDAO();
     $twitter_plugin = new TwitterPlugin();
     $twitter_plugin->crawl();
     $instance_dao = new InstanceMySQLDAO();
     $updated_instance = $instance_dao->get(1);
     $this->debug(Utils::varDumpToString($updated_instance));
     // crawler_last_run should have been updated
     $this->assertNotEqual($instance_builder_1->columns['crawler_last_run'], $updated_instance->crawler_last_run);
 }