createMock(LtiProvider::class); $ltiProviderMock->method('getId')->willReturn('id1'); $user = new LtiProviderUser($ltiProviderMock); $this->assertSame($ltiProviderMock, $user->getLtiProvider()); } public function testUniqueId() { /** @var LtiProvider|MockObject $ltiProviderMock1 */ $ltiProviderMock1 = $this->createMock(LtiProvider::class); $ltiProviderMock1->method('getId')->willReturn('id1'); /** @var LtiProvider|MockObject $ltiProviderMock2 */ $ltiProviderMock2 = $this->createMock(LtiProvider::class); $ltiProviderMock2->method('getId')->willReturn('id2'); /** @var LtiProvider|MockObject $ltiProviderMock3 */ $ltiProviderMock3 = $this->createMock(LtiProvider::class); $ltiProviderMock3->method('getId')->willReturn('id3'); $user1 = new LtiProviderUser($ltiProviderMock1); $user2 = new LtiProviderUser($ltiProviderMock2); $user3 = new LtiProviderUser($ltiProviderMock3); $ids = array_unique([$user1->getIdentifier(), $user2->getIdentifier(), $user3->getIdentifier()]); $this->assertCount(3, $ids); } }