1 | <?php |
||||
2 | |||||
3 | namespace Jalle19\StatusManager\Test\Database; |
||||
4 | |||||
5 | use Jalle19\StatusManager\Database\UserQuery; |
||||
6 | use PHPUnit\Framework\TestCase; |
||||
7 | |||||
8 | /** |
||||
9 | * Class UserQueryTest |
||||
10 | * @package Jalle19\StatusManager\Test\Database |
||||
11 | * @copyright Copyright © Sam Stenvall 2016- |
||||
12 | * @license https://www.gnu.org/licenses/gpl.html The GNU General Public License v2.0 |
||||
13 | */ |
||||
14 | class UserQueryTest extends TestCase |
||||
15 | { |
||||
16 | |||||
17 | /** |
||||
18 | * There should be four filter calls for three passed names, since the DVR user is added transparently |
||||
19 | */ |
||||
20 | public function testFilterIgnoredUsers() |
||||
21 | { |
||||
22 | $mock = $this->getMockedUserQuery(); |
||||
23 | $mock->expects($this->exactly(4)) |
||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||
24 | ->method('filterByName'); |
||||
25 | |||||
26 | $ignoredUsers = [ |
||||
27 | 'foo', |
||||
28 | 'bar', |
||||
29 | 'baz', |
||||
30 | ]; |
||||
31 | |||||
32 | $mock->filterIgnoredUsers($ignoredUsers); |
||||
33 | } |
||||
34 | |||||
35 | |||||
36 | /** |
||||
37 | * When no ignored users are specified, only the DVR user should be added |
||||
38 | */ |
||||
39 | public function testFilterIgnoredUsersNone() |
||||
40 | { |
||||
41 | $mock = $this->getMockedUserQuery(); |
||||
42 | $mock->expects($this->once()) |
||||
43 | ->method('filterByName'); |
||||
44 | |||||
45 | $mock->filterIgnoredUsers([]); |
||||
46 | } |
||||
47 | |||||
48 | |||||
49 | /** |
||||
50 | * @return \PHPUnit_Framework_MockObject_MockObject|UserQuery |
||||
51 | */ |
||||
52 | private function getMockedUserQuery() |
||||
53 | { |
||||
54 | return $this->getMockBuilder(UserQuery::class) |
||||
0 ignored issues
–
show
The function
PHPUnit\Framework\MockOb...ckBuilder::setMethods() has been deprecated: https://github.com/sebastianbergmann/phpunit/pull/3687
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This function has been deprecated. The supplier of the function has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead. ![]() |
|||||
55 | ->setMethods(['filterByName']) |
||||
56 | ->getMock(); |
||||
57 | } |
||||
58 | |||||
59 | } |
||||
60 |