[ticket/13713] Fix tests

PHPBB3-13713
This commit is contained in:
lavigor 2018-08-03 07:11:18 +03:00 committed by Marc Alexander
parent 5651c7f3ff
commit 118b98841c
No known key found for this signature in database
GPG key ID: 50E0D2423696F995
2 changed files with 82 additions and 38 deletions

View file

@ -1,15 +1,15 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
@ -49,7 +49,8 @@ class phpbb_mention_controller_test extends phpbb_database_test_case
$auth->expects($this->any())
->method('acl_gets')
->with('a_group', 'a_groupadd', 'a_groupdel')
->willReturn(false);
->willReturn(false)
;
// Config
$config = new \phpbb\config\config(array(
@ -90,7 +91,8 @@ class phpbb_mention_controller_test extends phpbb_database_test_case
$request->expects($this->any())
->method('is_ajax')
->willReturn(true);
->willReturn(true)
;
$user_loader = new \phpbb\user_loader($db, $phpbb_root_path, $phpEx, USERS_TABLE);
@ -142,6 +144,7 @@ class phpbb_mention_controller_test extends phpbb_database_test_case
* NOTE:
* 1) in production comparison with 'myself' is being done in JS
* 2) mention_names_limit does not limit the number of returned items
* 3) team members of hidden groups can also be mentioned (because they are shown on teampage)
*/
return [
['', 0, [
@ -178,6 +181,17 @@ class phpbb_mention_controller_test extends phpbb_database_test_case
'rank' => '',
'priority' => 0,
],
[
'name' => 'team_member_hidden',
'type' => 'u',
'id' => 6,
'avatar' => [
'type' => 'user',
'img' => '',
],
'rank' => '',
'priority' => 1,
],
[
'name' => 'team_member_normal',
'type' => 'u',
@ -345,6 +359,17 @@ class phpbb_mention_controller_test extends phpbb_database_test_case
'rank' => '',
'priority' => 0,
],
[
'name' => 'team_member_hidden',
'type' => 'u',
'id' => 6,
'avatar' => [
'type' => 'user',
'img' => '',
],
'rank' => '',
'priority' => 1,
],
[
'name' => 'team_member_normal',
'type' => 'u',
@ -501,6 +526,17 @@ class phpbb_mention_controller_test extends phpbb_database_test_case
],
]],
['t', 1, [
[
'name' => 'team_member_hidden',
'type' => 'u',
'id' => 6,
'avatar' => [
'type' => 'user',
'img' => '',
],
'rank' => '',
'priority' => 1,
],
[
'name' => 'team_member_normal',
'type' => 'u',
@ -647,11 +683,13 @@ class phpbb_mention_controller_test extends phpbb_database_test_case
$this->request->expects($this->at(1))
->method('variable')
->with('keyword', '', true)
->willReturn($keyword);
->willReturn($keyword)
;
$this->request->expects($this->at(2))
->method('variable')
->with('topic_id', 0)
->willReturn($topic_id);
->willReturn($topic_id)
;
$data = json_decode($this->controller->handle()->getContent(), true);
$this->assertEquals($expected_result, $data);
}

View file

@ -49,9 +49,15 @@
</row>
</table>
<table name="phpbb_teampage">
<column>teampage_id</column>
<column>group_id</column>
<row>
<value>1</value>
<value>1</value>
</row>
<row>
<value>2</value>
<value>2</value>
</row>
</table>
<table name="phpbb_topics">