Exemplo n.º 1
0
 public function testPublicPostWithMixedAccessReplies()
 {
     $b = $this->activateEmbedThread();
     $post_builder = FixtureBuilder::build('posts', array('post_id' => '1001', 'author_user_id' => '10', 'author_username' => 'ev', 'post_text' => 'This is a test post', 'retweet_count_cache' => '5', 'network' => 'twitter', 'is_protected' => 0));
     $user_builder = FixtureBuilder::build('users', array('user_id' => '10', 'username' => 'ev', 'is_protected' => '0', 'network' => 'twitter'));
     $public_reply_author_builder1 = FixtureBuilder::build('users', array('user_id' => '11', 'username' => 'jack', 'is_protected' => '0', 'network' => 'twitter'));
     $reply_builder1 = FixtureBuilder::build('posts', array('post_id' => '1002', 'author_user_id' => '11', 'author_username' => 'jack', 'post_text' => 'This is a public reply to 1001', 'network' => 'twitter', 'in_reply_to_post_id' => 1001, 'is_protected' => '0'));
     $public_reply_author_builder2 = FixtureBuilder::build('users', array('user_id' => '12', 'username' => 'jill', 'is_protected' => '0', 'network' => 'twitter'));
     $reply_builder2 = FixtureBuilder::build('posts', array('post_id' => '1003', 'author_user_id' => '12', 'author_username' => 'jill', 'post_text' => 'This is another public reply to 1001', 'network' => 'twitter', 'in_reply_to_post_id' => 1001, 'is_protected' => '0'));
     $private_reply_author_builder1 = FixtureBuilder::build('users', array('user_id' => '13', 'username' => 'mary', 'is_protected' => '1', 'network' => 'twitter'));
     $reply_builder3 = FixtureBuilder::build('posts', array('post_id' => '1004', 'author_user_id' => '13', 'author_username' => 'mary', 'post_text' => 'This is a private reply to 1001', 'network' => 'twitter', 'in_reply_to_post_id' => 1001, 'is_protected' => '1'));
     $_GET['p'] = 1001;
     $_GET['n'] = 'twitter';
     $plugin_dao = new PluginMySQLDAO();
     $plugin_id = $plugin_dao->getPluginId('embedthread');
     $this->debug($plugin_dao->isPluginActive($plugin_id) ? "EmbedThread is active" : "Not active");
     $controller = new ThreadJSController(true);
     $results = $controller->go();
     $v_mgr = $controller->getViewManager();
     $config = Config::getInstance();
     $this->assertPattern('/This is a test post/', $results);
     $this->assertPattern('/This is a public reply to 1001/', $results);
     $this->assertPattern('/This is another public reply to 1001/', $results);
     $this->assertNoPattern('/This is a private reply to 1001/', $results);
     $this->debug($results);
 }
Exemplo n.º 2
0
 public function testValidatePluginId()
 {
     // init our dao
     $dao = new PluginMySQLDAO();
     $builder = FixtureBuilder::build('plugins', array('is_active' => 1));
     $this->assertFalse($dao->isValidPluginId(-99));
     $this->assertTrue($dao->isValidPluginId($builder->columns['last_insert_id']));
 }