コード例 #1
0
 public function testDeactivate()
 {
     //all facebook and facebook page accounts should be set to inactive on plugin deactivation
     $webapp = Webapp::getInstance();
     $logger = Logger::getInstance();
     $pd = DAOFactory::getDAO('PostDAO');
     $instance = new Instance();
     $instance->network_user_id = 1;
     $instance_builder_1 = FixtureBuilder::build('instances', array('network_username' => 'julie', 'network' => 'facebook', 'crawler_last_run' => '-1d', 'is_activated' => '1', 'is_public' => '1'));
     $instance_builder_2 = FixtureBuilder::build('instances', array('network_username' => 'julie', 'network' => 'facebook page', 'crawler_last_run' => '-1d', 'is_activated' => '1', 'is_public' => '1'));
     $instance_dao = DAOFactory::getDAO('InstanceDAO');
     $fb_active_instances = $instance_dao->getAllInstances("DESC", true, "facebook");
     $this->assertEqual(sizeof($fb_active_instances), 1);
     $fb_active_instances = $instance_dao->getAllInstances("DESC", true, "facebook page");
     $this->assertEqual(sizeof($fb_active_instances), 1);
     $fb_plugin = new FacebookPlugin();
     $fb_plugin->deactivate();
     $fb_active_instances = $instance_dao->getAllInstances("DESC", true, "facebook");
     $this->assertEqual(sizeof($fb_active_instances), 0);
     $fb_active_instances = $instance_dao->getAllInstances("DESC", true, "facebook page");
     $this->assertEqual(sizeof($fb_active_instances), 0);
     $logger->close();
 }