45         $mail = 
"mail@test.de";
    46         $mail_2 = 
"mail2@test.de";
    47         $external_mails = [$mail, $mail_2];
    49         $result = $this->createMock(Result::class);
    51         $transformation = $this->createMock(Transformation::class);
    52         $transformation->expects(self::once())->method(
'applyTo')->willReturn($result);
    54         $legal_documents = $this->createMock(Conductor::class);
    55         $legal_documents->expects(self::once())->method(
'userCanReadInternalMail')->willReturn($transformation);
    57         $user = $this->createMock(ilObjUser::class);
    58         $user->expects($this->once())
    61         $user->expects($this->once())
    62              ->method(
"checkTimeLimit")
    65         $mail_options = $this->createMock(ilMailOptions::class);
    66         $mail_options->expects($this->exactly(3))
    67                      ->method(
"getIncomingType")
    70         $mail_options->expects($this->atLeastOnce())
    71                      ->method(
"getExternalEmailAddresses")
    72                      ->willReturn($external_mails);
    74         $recipient = 
new Recipient($user_id, $user, $mail_options, $legal_documents);
    75         $this->assertEquals($user_id, $recipient->getUserId());
    76         $this->assertTrue($recipient->isUser());
    77         $this->assertSame($result, $recipient->evaluateInternalMailReadability());
    78         $this->assertTrue($recipient->isUserActive());
    80         $this->assertSame($mail_options, $recipient->getMailOptions());
    81         $this->assertTrue($recipient->userWantsToReceiveExternalMails());
    82         $this->assertFalse($recipient->onlyToExternalMailAddress());
    83         $this->assertIsArray($recipient->getExternalMailAddress());
    84         $this->assertCount(2, $recipient->getExternalMailAddress());
    85         $this->assertContainsOnly(
'string', $recipient->getExternalMailAddress());