ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilMailAddressTypesTest Class Reference
+ Inheritance diagram for ilMailAddressTypesTest:
+ Collaboration diagram for ilMailAddressTypesTest:

Public Member Functions

 testFactoryWillReturnListAddressTypeForListName ()
 
 testFactoryWillReturnGroupAddressTypeForGroupName ()
 
 testFactoryWillReturnLoginOrEmailAddressAddressType ()
 
 testFactoryWillReturnRoleAddressType ()
 
 testAdminGroupNameIsAValidMailAddressTypes ()
 
 testMemberGroupNameIsAValidMailAddressType ()
 
 testAdminCourseNameIsAValidMailAddressType ()
 
 testMemberCourseNameIsAValidMailAddressType ()
 
 testCacheOnlyResolvesAndValidatesRecipientsOnceIfCachingIsEnabled ()
 
 testCacheResolvesAndValidatesRecipientsOnEveryCallIfCachingIsDisabled ()
 

Protected Member Functions

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

Private Member Functions

 createGroupNameAsValidatorMock ()
 
 getWrappedAddressType (ilMailAddressType $type)
 

Detailed Description

Definition at line 23 of file ilMailAddressTypesTest.php.

Member Function Documentation

◆ createGroupNameAsValidatorMock()

ilMailAddressTypesTest::createGroupNameAsValidatorMock ( )
private

◆ getWrappedAddressType()

ilMailAddressTypesTest::getWrappedAddressType ( ilMailAddressType  $type)
private

◆ setUp()

ilMailAddressTypesTest::setUp ( )
protected

Reimplemented from ilMailBaseTestCase.

Definition at line 25 of file ilMailAddressTypesTest.php.

References ilMailCachedAddressType\clearCache(), and setUp().

+ Here is the call graph for this function:

◆ testAdminCourseNameIsAValidMailAddressType()

ilMailAddressTypesTest::testAdminCourseNameIsAValidMailAddressType ( )

Definition at line 149 of file ilMailAddressTypesTest.php.

149 : void
150 {
151 $group_name_validator = $this->createGroupNameAsValidatorMock();
152 $group_name_validator->method('validate')->willReturn(false);
153
154 $mail_address_type_factory = $this->getAddressTypeFactory($group_name_validator);
155
156 $result = $mail_address_type_factory->getByPrefix(new ilMailAddress('#il_crs_admin_98', ''), false);
157
158 $this->assertInstanceOf('ilMailRoleAddressType', $this->getWrappedAddressType($result));
159 }
getWrappedAddressType(ilMailAddressType $type)

References createGroupNameAsValidatorMock(), and getWrappedAddressType().

+ Here is the call graph for this function:

◆ testAdminGroupNameIsAValidMailAddressTypes()

ilMailAddressTypesTest::testAdminGroupNameIsAValidMailAddressTypes ( )

Definition at line 125 of file ilMailAddressTypesTest.php.

125 : void
126 {
127 $group_name_validator = $this->createGroupNameAsValidatorMock();
128 $group_name_validator->method('validate')->willReturn(false);
129
130 $mail_address_type_factory = $this->getAddressTypeFactory($group_name_validator);
131
132 $result = $mail_address_type_factory->getByPrefix(new ilMailAddress('#il_grp_admin_98', ''), false);
133
134 $this->assertInstanceOf('ilMailRoleAddressType', $this->getWrappedAddressType($result));
135 }

References createGroupNameAsValidatorMock(), and getWrappedAddressType().

+ Here is the call graph for this function:

◆ testCacheOnlyResolvesAndValidatesRecipientsOnceIfCachingIsEnabled()

ilMailAddressTypesTest::testCacheOnlyResolvesAndValidatesRecipientsOnceIfCachingIsEnabled ( )

Definition at line 611 of file ilMailAddressTypesTest.php.

611 : void
612 {
613 $origin = $this->getMockBuilder(ilMailAddressType::class)->getMock();
614
615 $origin->expects($this->once())->method('resolve');
616 $origin->expects($this->once())->method('validate');
617
618 $type = new ilMailCachedAddressType($origin, true);
619 $type->resolve();
620 $type->resolve();
621
622 $type->validate(6);
623 $type->validate(6);
624 }

◆ testCacheResolvesAndValidatesRecipientsOnEveryCallIfCachingIsDisabled()

ilMailAddressTypesTest::testCacheResolvesAndValidatesRecipientsOnEveryCallIfCachingIsDisabled ( )

Definition at line 626 of file ilMailAddressTypesTest.php.

626 : void
627 {
628 $origin = $this->getMockBuilder(ilMailAddressType::class)->getMock();
629
630 $origin->expects($this->exactly(3))->method('resolve');
631 $origin->expects($this->exactly(3))->method('validate');
632
633 $type = new ilMailCachedAddressType($origin, false);
634 $type->resolve();
635 $type->resolve();
636 $type->resolve();
637
638 $type->validate(6);
639 $type->validate(6);
640 $type->validate(6);
641 }

◆ testFactoryWillReturnGroupAddressTypeForGroupName()

ilMailAddressTypesTest::testFactoryWillReturnGroupAddressTypeForGroupName ( )

Definition at line 89 of file ilMailAddressTypesTest.php.

89 : void
90 {
91 $group_name_validator = $this->createGroupNameAsValidatorMock();
92 $group_name_validator->method('validate')->willReturn(true);
93
94 $mail_address_type_factory = $this->getAddressTypeFactory($group_name_validator);
95
96 $result = $mail_address_type_factory->getByPrefix(new ilMailAddress('#MyGroup', ''), false);
97
98 $this->assertInstanceOf('ilMailGroupAddressType', $this->getWrappedAddressType($result));
99 }

References createGroupNameAsValidatorMock(), and getWrappedAddressType().

+ Here is the call graph for this function:

◆ testFactoryWillReturnListAddressTypeForListName()

ilMailAddressTypesTest::testFactoryWillReturnListAddressTypeForListName ( )

Definition at line 77 of file ilMailAddressTypesTest.php.

77 : void
78 {
79 $group_name_validator = $this->createGroupNameAsValidatorMock();
80 $group_name_validator->method('validate')->willReturn(true);
81
82 $mail_address_type_factory = $this->getAddressTypeFactory($group_name_validator);
83
84 $result = $mail_address_type_factory->getByPrefix(new ilMailAddress('#il_ml_4711', ''), false);
85
86 $this->assertInstanceOf('ilMailMailingListAddressType', $this->getWrappedAddressType($result));
87 }

References createGroupNameAsValidatorMock(), and getWrappedAddressType().

+ Here is the call graph for this function:

◆ testFactoryWillReturnLoginOrEmailAddressAddressType()

ilMailAddressTypesTest::testFactoryWillReturnLoginOrEmailAddressAddressType ( )

Definition at line 101 of file ilMailAddressTypesTest.php.

101 : void
102 {
103 $group_name_validator = $this->createGroupNameAsValidatorMock();
104 $group_name_validator->method('validate')->willReturn(false);
105
106 $mail_address_type_factory = $this->getAddressTypeFactory($group_name_validator);
107
108 $result = $mail_address_type_factory->getByPrefix(new ilMailAddress('phpunit', ''), false);
109
110 $this->assertInstanceOf('ilMailLoginOrEmailAddressAddressType', $this->getWrappedAddressType($result));
111 }

References createGroupNameAsValidatorMock(), and getWrappedAddressType().

+ Here is the call graph for this function:

◆ testFactoryWillReturnRoleAddressType()

ilMailAddressTypesTest::testFactoryWillReturnRoleAddressType ( )

Definition at line 113 of file ilMailAddressTypesTest.php.

113 : void
114 {
115 $group_name_validator = $this->createGroupNameAsValidatorMock();
116 $group_name_validator->method('validate')->willReturn(false);
117
118 $mail_address_type_factory = $this->getAddressTypeFactory($group_name_validator);
119
120 $result = $mail_address_type_factory->getByPrefix(new ilMailAddress('#member', ''), false);
121
122 $this->assertInstanceOf('ilMailRoleAddressType', $this->getWrappedAddressType($result));
123 }

References createGroupNameAsValidatorMock(), and getWrappedAddressType().

+ Here is the call graph for this function:

◆ testMemberCourseNameIsAValidMailAddressType()

ilMailAddressTypesTest::testMemberCourseNameIsAValidMailAddressType ( )

Definition at line 161 of file ilMailAddressTypesTest.php.

161 : void
162 {
163 $group_name_validator = $this->createGroupNameAsValidatorMock();
164 $group_name_validator->method('validate')->willReturn(false);
165
166 $mail_address_type_factory = $this->getAddressTypeFactory($group_name_validator);
167
168 $result = $mail_address_type_factory->getByPrefix(new ilMailAddress('#il_crs_member_98', ''), false);
169
170 $this->assertInstanceOf('ilMailRoleAddressType', $this->getWrappedAddressType($result));
171 }

References createGroupNameAsValidatorMock(), and getWrappedAddressType().

+ Here is the call graph for this function:

◆ testMemberGroupNameIsAValidMailAddressType()

ilMailAddressTypesTest::testMemberGroupNameIsAValidMailAddressType ( )

Definition at line 137 of file ilMailAddressTypesTest.php.

137 : void
138 {
139 $group_name_validator = $this->createGroupNameAsValidatorMock();
140 $group_name_validator->method('validate')->willReturn(false);
141
142 $mail_address_type_factory = $this->getAddressTypeFactory($group_name_validator);
143
144 $result = $mail_address_type_factory->getByPrefix(new ilMailAddress('#il_grp_member_98', ''), false);
145
146 $this->assertInstanceOf('ilMailRoleAddressType', $this->getWrappedAddressType($result));
147 }

References createGroupNameAsValidatorMock(), and getWrappedAddressType().

+ Here is the call graph for this function:

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