1 | <?php |
||
11 | class UserServiceTest extends TestCase |
||
12 | { |
||
13 | |||
14 | private $userService; |
||
15 | /** |
||
16 | * @test |
||
17 | */ |
||
18 | private $user; |
||
19 | /** |
||
20 | * @var EntityRepository|\PHPUnit\Framework\MockObject\MockObject |
||
21 | */ |
||
22 | private $repo; |
||
23 | /** |
||
24 | * @var GvEntityManager|\PHPUnit\Framework\MockObject\MockObject |
||
25 | */ |
||
26 | private $gvEntityManager; |
||
27 | |||
28 | public function validateEmail() |
||
35 | |||
36 | public function setUp():void |
||
37 | { |
||
38 | $this->repo = $this->createMock(EntityRepository::class); |
||
39 | |||
40 | |||
41 | $this->gvEntityManager = $this->createMock(GvEntityManager::class); |
||
42 | $gvEntityManager = $this->gvEntityManager; |
||
43 | $gvEntityManager->expects($this->any()) |
||
44 | ->method('getRepository') |
||
45 | ->willReturn($this->repo); |
||
46 | |||
47 | $session = $this->createMock(Session::class); |
||
48 | $session->expects($this->any()) |
||
49 | ->method('set') |
||
50 | ->with($this->isType('string'), $this->isType('array')) |
||
51 | ->willReturn(true); |
||
52 | |||
53 | $this->userService = new \Gvera\Services\UserService($gvEntityManager, $session, new ValidationService()); |
||
54 | |||
55 | $role = new UserRole(); |
||
56 | $role->setName("testRole"); |
||
57 | $role->setRolePriority(5); |
||
58 | |||
59 | $user = new User(); |
||
60 | $user->setEmail("[email protected]"); |
||
61 | $user->setUsername("test"); |
||
62 | $user->setRole($role); |
||
63 | |||
64 | $this->user = $user; |
||
65 | $passHash = $this->userService->generatePassword('test'); |
||
66 | $user->setPassword($passHash); |
||
67 | |||
68 | |||
69 | |||
70 | $session->expects($this->any()) |
||
71 | ->method('get') |
||
72 | ->with('user') |
||
73 | ->willReturn(['role' => $role->getRolePriority(), 'username' => $user->getUsername()]); |
||
74 | |||
75 | parent::setUp(); // TODO: Change the autogenerated stub |
||
76 | } |
||
77 | |||
78 | /** |
||
79 | * @test |
||
80 | */ |
||
81 | public function generateAndValidatePassword() |
||
88 | |||
89 | /** |
||
90 | * @test |
||
91 | */ |
||
92 | public function login() |
||
140 | |||
141 | /** |
||
142 | * @test |
||
143 | */ |
||
144 | public function logout() |
||
163 | |||
164 | public function testUserAuthorization() |
||
191 | } |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.