1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-06-07 15:05:43 +02:00

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

View File

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