ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
RecipientTest Class Reference
+ Inheritance diagram for RecipientTest:
+ Collaboration diagram for RecipientTest:

Public Member Functions

 testCreate ()
 
 testCheckProperties ()
 
 testPropertiesPart2 ()
 

Additional Inherited Members

- Protected Member Functions inherited from ilMailBaseTestCase
 brutallyTrimHTML (string $html)
 
 setUp ()
 
 tearDown ()
 
 setGlobalVariable (string $name, $value)
 

Detailed Description

Definition at line 26 of file RecipientTest.php.

Member Function Documentation

◆ testCheckProperties()

RecipientTest::testCheckProperties ( )

Definition at line 42 of file RecipientTest.php.

References $user_id.

42  : void
43  {
44  $user_id = 10;
45  $mail = "mail@test.de";
46  $mail_2 = "mail2@test.de";
47  $external_mails = [$mail, $mail_2];
48 
49  $result = $this->createMock(Result::class);
50 
51  $transformation = $this->createMock(Transformation::class);
52  $transformation->expects(self::once())->method('applyTo')->willReturn($result);
53 
54  $legal_documents = $this->createMock(Conductor::class);
55  $legal_documents->expects(self::once())->method('userCanReadInternalMail')->willReturn($transformation);
56 
57  $user = $this->createMock(ilObjUser::class);
58  $user->expects($this->once())
59  ->method("getActive")
60  ->willReturn(true);
61  $user->expects($this->once())
62  ->method("checkTimeLimit")
63  ->willReturn(true);
64 
65  $mail_options = $this->createMock(ilMailOptions::class);
66  $mail_options->expects($this->exactly(3))
67  ->method("getIncomingType")
68  ->willReturn(2);
69 
70  $mail_options->expects($this->atLeastOnce())
71  ->method("getExternalEmailAddresses")
72  ->willReturn($external_mails);
73 
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());
79 
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());
86  }

◆ testCreate()

RecipientTest::testCreate ( )

Definition at line 28 of file RecipientTest.php.

References $user_id, and null.

28  : void
29  {
30  $user_id = 10;
31  $user = $this->createMock(ilObjUser::class);
32  $mail_options = $this->createMock(ilMailOptions::class);
33  $recipient = new Recipient($user_id, $user, $mail_options, $this->createMock(Conductor::class));
34  $this->assertEquals($user_id, $recipient->getUserId());
35  $this->assertSame($mail_options, $recipient->getMailOptions());
36 
37  $recipient = new Recipient($user_id, null, $mail_options, $this->createMock(Conductor::class));
38  $this->assertEquals($user_id, $recipient->getUserId());
39  $this->assertSame($mail_options, $recipient->getMailOptions());
40  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ testPropertiesPart2()

RecipientTest::testPropertiesPart2 ( )

Definition at line 88 of file RecipientTest.php.

References $user_id.

88  : void
89  {
90  $user_id = 133;
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 
115  $recipient = new Recipient($user_id, $user, $mail_options, $legal_documents);
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  }

The documentation for this class was generated from the following file: