/** * @dataProvider get_forums_visibility_sql_data */ public function test_get_forums_visibility_sql($table, $mode, $forum_ids, $table_alias, $permissions, $expected) { global $cache, $db, $auth, $phpbb_root_path, $phpEx; $cache = new phpbb_mock_cache(); $db = $this->new_dbal(); // Create auth mock $auth = $this->getMock('\\phpbb\\auth\\auth'); $auth->expects($this->any())->method('acl_getf')->with($this->stringContains('_'), $this->anything())->will($this->returnValueMap($permissions)); $user = new \phpbb\user('\\phpbb\\datetime'); $config = new phpbb\config\config(array()); $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $content_visibility = new \phpbb\content_visibility($auth, $config, $phpbb_dispatcher, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE); $result = $db->sql_query('SELECT ' . $mode . '_id FROM ' . $table . ' WHERE ' . $content_visibility->get_forums_visibility_sql($mode, $forum_ids, $table_alias) . ' ORDER BY ' . $mode . '_id ASC'); $this->assertEquals($expected, $db->sql_fetchrowset($result)); }