88 : void
89 {
91 $mail = "mails@test.de";
92 $mail_2 = "mails2@test.de";
93 $external_mails = [$mail, $mail_2];
94
95 $legal_documents = $this->createMock(Conductor::class);
96 $legal_documents->expects(self::never())->method('userCanReadInternalMail');
97
98 $user = $this->createMock(ilObjUser::class);
99 $user->expects($this->once())
100 ->method("getActive")
101 ->willReturn(false);
102 $user->expects($this->once())
103 ->method("checkTimeLimit")
104 ->willReturn(false);
105
106 $mail_options = $this->createMock(ilMailOptions::class);
107 $mail_options->expects($this->exactly(3))
108 ->method("getIncomingType")
109 ->willReturn(0);
110
111 $mail_options->expects($this->atLeastOnce())
112 ->method("getExternalEmailAddresses")
113 ->willReturn($external_mails);
114
116 $this->assertEquals(
$user_id, $recipient->getUserId());
117 $this->assertTrue($recipient->isUser());
118 $result = $recipient->evaluateInternalMailReadability();
119 $this->assertFalse($result->isOk());
120 $this->assertSame('Account expired.', $result->error());
121 $this->assertFalse($recipient->isUserActive());
122
123 $this->assertSame($mail_options, $recipient->getMailOptions());
124 $this->assertFalse($recipient->userWantsToReceiveExternalMails());
125 $this->assertFalse($recipient->onlyToExternalMailAddress());
126 $this->assertIsArray($recipient->getExternalMailAddress());
127 $this->assertCount(2, $recipient->getExternalMailAddress());
128 $this->assertContainsOnly('string', $recipient->getExternalMailAddress());
129 }