@@ 75-87 (lines=13) @@ | ||
72 | $this->assertNull($user); |
|
73 | } |
|
74 | ||
75 | public function testGetOrCreateUserReturnsUser() |
|
76 | { |
|
77 | $object = $this->object; |
|
78 | $this->getFinder()->expects($this->once())->method('findUserByGoogleSignInData')->willReturn(new User()); |
|
79 | $mockGroup = $this->createMock(Group::class); |
|
80 | $mockRepo = $this->createMock(EntityRepository::class); |
|
81 | $mockRepo->expects($this->once())->method('findOneBy')->willReturn($mockGroup); |
|
82 | $this->getEm()->expects($this->once())->method('getRepository')->willReturn($mockRepo); |
|
83 | $this->getEm()->expects($this->once())->method('persist')->willReturn(true); |
|
84 | $this->getEm()->expects($this->once())->method('flush')->willReturn(true); |
|
85 | $user = $object->getOrCreateUser('[email protected]', 12345679); |
|
86 | $this->assertInstanceOf(User::class, $user); |
|
87 | } |
|
88 | ||
89 | public function testGetOrCreateUserCreatesCorrectUserClass() |
|
90 | { |
|
@@ 89-101 (lines=13) @@ | ||
86 | $this->assertInstanceOf(User::class, $user); |
|
87 | } |
|
88 | ||
89 | public function testGetOrCreateUserCreatesCorrectUserClass() |
|
90 | { |
|
91 | $object = $this->object; |
|
92 | $this->getFinder()->expects($this->once())->method('findUserByGoogleSignInData')->willReturn(new DateTime()); |
|
93 | $mockGroup = $this->createMock(Group::class); |
|
94 | $mockRepo = $this->createMock(EntityRepository::class); |
|
95 | $mockRepo->expects($this->once())->method('findOneBy')->willReturn($mockGroup); |
|
96 | $this->getEm()->expects($this->once())->method('getRepository')->willReturn($mockRepo); |
|
97 | $this->getEm()->expects($this->once())->method('persist')->willReturn(true); |
|
98 | $this->getEm()->expects($this->once())->method('flush')->willReturn(true); |
|
99 | $user = $object->getOrCreateUser('[email protected]', 12345679); |
|
100 | $this->assertInstanceOf(User::class, $user); |
|
101 | } |
|
102 | ||
103 | /** |
|
104 | * @throws \ReflectionException |