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