Class ilMailAddressTypesTest.
More...
◆ createGroupNameAsValidatorMock()
ilMailAddressTypesTest::createGroupNameAsValidatorMock |
( |
| ) |
|
|
private |
◆ getAddressTypeFactory()
ilMailAddressTypesTest::getAddressTypeFactory |
( |
|
$groupNameValidatorMock | ) |
|
|
private |
◆ getWrappedAddressType()
◆ setUp()
ilMailAddressTypesTest::setUp |
( |
| ) |
|
◆ testAddressCanBeValidatedFromLoginOrEmailAddressType()
ilMailAddressTypesTest::testAddressCanBeValidatedFromLoginOrEmailAddressType |
( |
| ) |
|
- Exceptions
-
Definition at line 278 of file ilMailAddressTypesTest.php.
References $type.
280 $logger = $this->getMockBuilder(ilLogger::class)->disableOriginalConstructor()->getMock();
281 $addressTypeHelper = $this->getMockBuilder(ilMailAddressTypeHelper::class)->getMock();
283 $addressTypeHelper->expects($this->atLeast(3))->method(
'getInstallationHost')->willReturn(
'ilias');
284 $addressTypeHelper->expects($this->exactly(2))->method(
'getUserIdByLogin')->willReturnOnConsecutiveCalls(
290 $addressTypeHelper->expects($this->any())->method(
'receivesInternalMailsOnly')->willReturnOnConsecutiveCalls(
294 $rbacsystem = $this->getMockBuilder(ilRbacSystem::class)->disableOriginalConstructor()->getMock();
295 $rbacsystem->expects($this->exactly(2))->method(
'checkAccessOfUser')->willReturnOnConsecutiveCalls(
306 $this->assertTrue(
$type->validate(666));
307 $this->assertCount(0,
$type->getErrors());
309 $this->assertFalse(
$type->validate(666));
310 $this->assertArrayHasKey(0,
$type->getErrors());
311 $this->assertEquals(
'user_cant_receive_mail',
$type->getErrors()[0]->getLanguageVariable());
319 $this->assertTrue($type->validate(666));
320 $this->assertCount(0, $type->getErrors());
Class ilMailLoginOrEmailAddressAddressType.
◆ testAdminCourseNameIsAValidMailAddressType()
ilMailAddressTypesTest::testAdminCourseNameIsAValidMailAddressType |
( |
| ) |
|
◆ testAdminGroupNameIsAValidMailAddressTypes()
ilMailAddressTypesTest::testAdminGroupNameIsAValidMailAddressTypes |
( |
| ) |
|
◆ testCacheOnlyResolvesAndValidatesRecipientsOnceIfCachingIsEnabled()
ilMailAddressTypesTest::testCacheOnlyResolvesAndValidatesRecipientsOnceIfCachingIsEnabled |
( |
| ) |
|
- Exceptions
-
Definition at line 633 of file ilMailAddressTypesTest.php.
References $type.
635 $origin = $this->getMockBuilder(ilMailAddressType::class)->getMock();
637 $origin->expects($this->once())->method(
'resolve');
638 $origin->expects($this->once())->method(
'validate');
Class ilMailCachedAddressType.
◆ testCacheResolvesAndValidatesRecipientsOnEveryCallIfCachingIsDisabled()
ilMailAddressTypesTest::testCacheResolvesAndValidatesRecipientsOnEveryCallIfCachingIsDisabled |
( |
| ) |
|
- Exceptions
-
Definition at line 651 of file ilMailAddressTypesTest.php.
References $type.
653 $origin = $this->getMockBuilder(ilMailAddressType::class)->getMock();
655 $origin->expects($this->exactly(3))->method(
'resolve');
656 $origin->expects($this->exactly(3))->method(
'validate');
Class ilMailCachedAddressType.
◆ testFactoryWillReturnGroupAddressTypeForGroupName()
ilMailAddressTypesTest::testFactoryWillReturnGroupAddressTypeForGroupName |
( |
| ) |
|
◆ testFactoryWillReturnListAddressTypeForListName()
ilMailAddressTypesTest::testFactoryWillReturnListAddressTypeForListName |
( |
| ) |
|
◆ testFactoryWillReturnLoginOrEmailAddressAddressType()
ilMailAddressTypesTest::testFactoryWillReturnLoginOrEmailAddressAddressType |
( |
| ) |
|
◆ testFactoryWillReturnRoleAddressType()
ilMailAddressTypesTest::testFactoryWillReturnRoleAddressType |
( |
| ) |
|
◆ testMailingListAddressCanBeValidated()
ilMailAddressTypesTest::testMailingListAddressCanBeValidated |
( |
| ) |
|
- Exceptions
-
Definition at line 462 of file ilMailAddressTypesTest.php.
References $type.
464 $lists = $this->getMockBuilder(ilMailingLists::class)->disableOriginalConstructor()->setMethods([
467 $lists->expects($this->exactly(2))->method(
'mailingListExists')->with(
'#il_ml_4711')->willReturnOnConsecutiveCalls(
471 $logger = $this->getMockBuilder(ilLogger::class)->disableOriginalConstructor()->getMock();
472 $addressTypeHelper = $this->getMockBuilder(ilMailAddressTypeHelper::class)->getMock();
481 $this->assertTrue(
$type->validate(666));
482 $this->assertCount(0,
$type->getErrors());
484 $this->assertFalse(
$type->validate(666));
485 $this->assertCount(1,
$type->getErrors());
486 $this->assertArrayHasKey(0,
$type->getErrors());
487 $this->assertEquals(
'mail_no_valid_mailing_list',
$type->getErrors()[0]->getLanguageVariable());
Class ilMailMailingListAddressType.
◆ testMemberCourseNameIsAValidMailAddressType()
ilMailAddressTypesTest::testMemberCourseNameIsAValidMailAddressType |
( |
| ) |
|
◆ testMemberGroupNameIsAValidMailAddressType()
ilMailAddressTypesTest::testMemberGroupNameIsAValidMailAddressType |
( |
| ) |
|
◆ testNoUserIdCanBeResolvedFromEmailAddress()
ilMailAddressTypesTest::testNoUserIdCanBeResolvedFromEmailAddress |
( |
| ) |
|
- Exceptions
-
Definition at line 254 of file ilMailAddressTypesTest.php.
References $type.
256 $logger = $this->getMockBuilder(ilLogger::class)->disableOriginalConstructor()->getMock();
257 $rbacsystem = $this->getMockBuilder(ilRbacSystem::class)->disableOriginalConstructor()->getMock();
258 $addressTypeHelper = $this->getMockBuilder(ilMailAddressTypeHelper::class)->getMock();
260 $addressTypeHelper->expects($this->once())->method(
'getInstallationHost')->willReturn(
'ilias');
261 $addressTypeHelper->expects($this->once())->method(
'getUserIdByLogin')->willReturn(0);
270 $usrIds =
$type->resolve();
272 $this->assertCount(0, $usrIds);
Class ilMailLoginOrEmailAddressAddressType.
◆ testNoUserIdCanBeResolvedFromUnknownLoginAddress()
ilMailAddressTypesTest::testNoUserIdCanBeResolvedFromUnknownLoginAddress |
( |
| ) |
|
- Exceptions
-
Definition at line 230 of file ilMailAddressTypesTest.php.
References $type.
232 $logger = $this->getMockBuilder(ilLogger::class)->disableOriginalConstructor()->getMock();
233 $rbacsystem = $this->getMockBuilder(ilRbacSystem::class)->disableOriginalConstructor()->getMock();
234 $addressTypeHelper = $this->getMockBuilder(ilMailAddressTypeHelper::class)->getMock();
236 $addressTypeHelper->expects($this->once())->method(
'getInstallationHost')->willReturn(
'ilias');
237 $addressTypeHelper->expects($this->once())->method(
'getUserIdByLogin')->willReturn(0);
246 $usrIds =
$type->resolve();
248 $this->assertCount(0, $usrIds);
Class ilMailLoginOrEmailAddressAddressType.
◆ testNoUserIdsCanBeResolvedFromInvalidRoleAddress()
ilMailAddressTypesTest::testNoUserIdsCanBeResolvedFromInvalidRoleAddress |
( |
| ) |
|
- Exceptions
-
Definition at line 525 of file ilMailAddressTypesTest.php.
References $type.
527 $logger = $this->getMockBuilder(ilLogger::class)->disableOriginalConstructor()->getMock();
528 $rbacsystem = $this->getMockBuilder(ilRbacSystem::class)->disableOriginalConstructor()->getMock();
529 $rbacreview = $this->getMockBuilder(ilRbacReview::class)->disableOriginalConstructor()->setMethods([
'assignedUsers'])->getMock();
530 $addressTypeHelper = $this->getMockBuilder(ilMailAddressTypeHelper::class)->getMock();
531 $roleMailboxSearch = $this->getMockBuilder(ilRoleMailboxSearch::class)->disableOriginalConstructor()->setMethods([
'searchRoleIdsByAddressString'])->getMock();
533 $roleMailboxSearch->expects($this->once())->method(
'searchRoleIdsByAddressString')->willReturn([]);
534 $rbacreview->expects($this->never())->method(
'assignedUsers');
545 $usrIds =
$type->resolve();
547 $this->assertCount(0, $usrIds);
Class ilMailRoleAddressType.
◆ testPermissionsAreCheckedForRegularUsersWhenValidatingGlobalRoleAddresses()
ilMailAddressTypesTest::testPermissionsAreCheckedForRegularUsersWhenValidatingGlobalRoleAddresses |
( |
| ) |
|
- Exceptions
-
Definition at line 580 of file ilMailAddressTypesTest.php.
References $type.
582 $logger = $this->getMockBuilder(ilLogger::class)->disableOriginalConstructor()->getMock();
583 $rbacsystem = $this->getMockBuilder(ilRbacSystem::class)->disableOriginalConstructor()->setMethods([
'checkAccessOfUser'])->getMock();
584 $rbacreview = $this->getMockBuilder(ilRbacReview::class)->disableOriginalConstructor()->setMethods([
'isGlobalRole'])->getMock();
585 $addressTypeHelper = $this->getMockBuilder(ilMailAddressTypeHelper::class)->getMock();
586 $roleMailboxSearch = $this->getMockBuilder(ilRoleMailboxSearch::class)->disableOriginalConstructor()->setMethods([
'searchRoleIdsByAddressString'])->getMock();
588 $roleMailboxSearch->expects($this->exactly(4))->method(
'searchRoleIdsByAddressString')->willReturnOnConsecutiveCalls(
594 $rbacsystem->expects($this->exactly(4))->method(
'checkAccessOfUser')->willReturnOnConsecutiveCalls(
600 $rbacreview->expects($this->once())->method(
'isGlobalRole')->with(1)->willReturn(
true);
611 $this->assertFalse(
$type->validate(4711));
612 $this->assertCount(1,
$type->getErrors());
613 $this->assertArrayHasKey(0,
$type->getErrors());
614 $this->assertEquals(
'mail_to_global_roles_not_allowed',
$type->getErrors()[0]->getLanguageVariable());
616 $this->assertFalse(
$type->validate(4711));
617 $this->assertCount(1,
$type->getErrors());
618 $this->assertArrayHasKey(0,
$type->getErrors());
619 $this->assertEquals(
'mail_recipient_not_found',
$type->getErrors()[0]->getLanguageVariable());
621 $this->assertFalse(
$type->validate(4711));
622 $this->assertCount(1,
$type->getErrors());
623 $this->assertArrayHasKey(0,
$type->getErrors());
624 $this->assertEquals(
'mail_multiple_role_recipients_found',
$type->getErrors()[0]->getLanguageVariable());
626 $this->assertTrue(
$type->validate(4711));
627 $this->assertCount(0,
$type->getErrors());
Class ilMailRoleAddressType.
◆ testUserIdCanBeResolvedFromLoginAddress()
ilMailAddressTypesTest::testUserIdCanBeResolvedFromLoginAddress |
( |
| ) |
|
- Exceptions
-
Definition at line 204 of file ilMailAddressTypesTest.php.
References $type.
206 $logger = $this->getMockBuilder(ilLogger::class)->disableOriginalConstructor()->getMock();
207 $rbacsystem = $this->getMockBuilder(ilRbacSystem::class)->disableOriginalConstructor()->getMock();
208 $addressTypeHelper = $this->getMockBuilder(ilMailAddressTypeHelper::class)->getMock();
210 $addressTypeHelper->expects($this->once())->method(
'getInstallationHost')->willReturn(
'ilias');
211 $addressTypeHelper->expects($this->once())->method(
'getUserIdByLogin')->willReturn(4711);
220 $usrIds =
$type->resolve();
222 $this->assertCount(1, $usrIds);
223 $this->assertArrayHasKey(0, $usrIds);
224 $this->assertEquals(4711, $usrIds[0]);
Class ilMailLoginOrEmailAddressAddressType.
◆ testUserIdsCanBeResolvedFromGroupNameAddress()
ilMailAddressTypesTest::testUserIdsCanBeResolvedFromGroupNameAddress |
( |
| ) |
|
- Exceptions
-
Definition at line 326 of file ilMailAddressTypesTest.php.
References $type.
328 $logger = $this->getMockBuilder(ilLogger::class)->disableOriginalConstructor()->getMock();
329 $addressTypeHelper = $this->getMockBuilder(ilMailAddressTypeHelper::class)->getMock();
331 $group = $this->getMockBuilder(ilObjGroup::class)->disableOriginalConstructor()->setMethods([
'getGroupMemberIds'])->getMock();
332 $group->expects($this->once())->method(
'getGroupMemberIds')->willReturn([666, 777]);
334 $addressTypeHelper->expects($this->once())->method(
'getGroupObjIdByTitle')->willReturn(1);
335 $addressTypeHelper->expects($this->once())->method(
'getAllRefIdsForObjId')->with(1)->willReturn([2]);
336 $addressTypeHelper->expects($this->once())->method(
'getInstanceByRefId')->with(2)->willReturn($group);
344 $usrIds =
$type->resolve();
346 $this->assertCount(2, $usrIds);
Class ilMailGroupAddressType.
◆ testUserIdsCanBeResolvedFromMailingListAddress()
ilMailAddressTypesTest::testUserIdsCanBeResolvedFromMailingListAddress |
( |
| ) |
|
- Exceptions
-
Definition at line 415 of file ilMailAddressTypesTest.php.
References $type.
417 $logger = $this->getMockBuilder(ilLogger::class)->disableOriginalConstructor()->getMock();
418 $addressTypeHelper = $this->getMockBuilder(ilMailAddressTypeHelper::class)->getMock();
420 $list = $this->getMockBuilder(ilMailingList::class)->disableOriginalConstructor()->setMethods([
423 $list->expects($this->exactly(2))->method(
'getAssignedEntries')->willReturnOnConsecutiveCalls(
424 [[
'usr_id' => 1], [
'usr_id' => 2], [
'usr_id' => 3]],
428 $lists = $this->getMockBuilder(ilMailingLists::class)->disableOriginalConstructor()->setMethods([
430 'getCurrentMailingList' 432 $lists->expects($this->exactly(3))->method(
'mailingListExists')->with(
'#il_ml_4711')->willReturnOnConsecutiveCalls(
437 $lists->expects($this->exactly(2))->method(
'getCurrentMailingList')->willReturn($list);
446 $usrIds =
$type->resolve();
448 $this->assertCount(3, $usrIds);
450 $usrIds =
$type->resolve();
452 $this->assertCount(0, $usrIds);
454 $usrIds =
$type->resolve();
456 $this->assertCount(0, $usrIds);
Class ilMailMailingListAddressType.
◆ testUserIdsCanBeResolvedFromRoleAddress()
ilMailAddressTypesTest::testUserIdsCanBeResolvedFromRoleAddress |
( |
| ) |
|
- Exceptions
-
Definition at line 493 of file ilMailAddressTypesTest.php.
References $type.
495 $logger = $this->getMockBuilder(ilLogger::class)->disableOriginalConstructor()->getMock();
496 $rbacsystem = $this->getMockBuilder(ilRbacSystem::class)->disableOriginalConstructor()->getMock();
497 $rbacreview = $this->getMockBuilder(ilRbacReview::class)->disableOriginalConstructor()->setMethods([
'assignedUsers'])->getMock();
498 $addressTypeHelper = $this->getMockBuilder(ilMailAddressTypeHelper::class)->getMock();
499 $roleMailboxSearch = $this->getMockBuilder(ilRoleMailboxSearch::class)->disableOriginalConstructor()->setMethods([
'searchRoleIdsByAddressString'])->getMock();
501 $roleMailboxSearch->expects($this->once())->method(
'searchRoleIdsByAddressString')->willReturn([1, 2, 3]);
502 $rbacreview->expects($this->exactly(3))->method(
'assignedUsers')->willReturnOnConsecutiveCalls(
517 $usrIds =
$type->resolve();
519 $this->assertCount(6, $usrIds);
Class ilMailRoleAddressType.
◆ testUserIdsCannotBeResolvedFromNonExistingGroupNameAddress()
ilMailAddressTypesTest::testUserIdsCannotBeResolvedFromNonExistingGroupNameAddress |
( |
| ) |
|
- Exceptions
-
Definition at line 352 of file ilMailAddressTypesTest.php.
References $type.
354 $logger = $this->getMockBuilder(ilLogger::class)->disableOriginalConstructor()->getMock();
355 $addressTypeHelper = $this->getMockBuilder(ilMailAddressTypeHelper::class)->getMock();
357 $group = $this->getMockBuilder(ilObjGroup::class)->disableOriginalConstructor()->setMethods([
'getGroupMemberIds'])->getMock();
358 $group->expects($this->never())->method(
'getGroupMemberIds');
360 $addressTypeHelper->expects($this->once())->method(
'getGroupObjIdByTitle')->willReturn(0);
361 $addressTypeHelper->expects($this->once())->method(
'getAllRefIdsForObjId')->with(0)->willReturn([]);
362 $addressTypeHelper->expects($this->never())->method(
'getInstanceByRefId');
370 $usrIds =
$type->resolve();
372 $this->assertCount(0, $usrIds);
Class ilMailGroupAddressType.
◆ testValidationFailsForNonExistingGroupNameAddress()
ilMailAddressTypesTest::testValidationFailsForNonExistingGroupNameAddress |
( |
| ) |
|
- Exceptions
-
Definition at line 378 of file ilMailAddressTypesTest.php.
References $type.
380 $logger = $this->getMockBuilder(ilLogger::class)->disableOriginalConstructor()->getMock();
381 $addressTypeHelper = $this->getMockBuilder(ilMailAddressTypeHelper::class)->getMock();
383 $addressTypeHelper->expects($this->once())->method(
'doesGroupNameExists')->with(
'PhpUnit')->willReturn(
false);
390 $this->assertFalse(
$type->validate(666));
Class ilMailGroupAddressType.
◆ testValidationForAnonymousUserAsSystemActorSucceedsAlwaysForGlobalRoleAddresses()
ilMailAddressTypesTest::testValidationForAnonymousUserAsSystemActorSucceedsAlwaysForGlobalRoleAddresses |
( |
| ) |
|
- Exceptions
-
Definition at line 553 of file ilMailAddressTypesTest.php.
References $type.
555 $logger = $this->getMockBuilder(ilLogger::class)->disableOriginalConstructor()->getMock();
556 $rbacsystem = $this->getMockBuilder(ilRbacSystem::class)->disableOriginalConstructor()->getMock();
557 $rbacreview = $this->getMockBuilder(ilRbacReview::class)->disableOriginalConstructor()->getMock();
558 $addressTypeHelper = $this->getMockBuilder(ilMailAddressTypeHelper::class)->getMock();
559 $roleMailboxSearch = $this->getMockBuilder(ilRoleMailboxSearch::class)->disableOriginalConstructor()->setMethods([
'searchRoleIdsByAddressString'])->getMock();
561 $roleMailboxSearch->expects($this->once())->method(
'searchRoleIdsByAddressString')->willReturnOnConsecutiveCalls([1]);
562 $rbacsystem->expects($this->never())->method(
'checkAccessOfUser');
573 $this->assertTrue(
$type->validate(ANONYMOUS_USER_ID));
574 $this->assertCount(0,
$type->getErrors());
Class ilMailRoleAddressType.
◆ testValidationSucceedsForExistingGroupName()
ilMailAddressTypesTest::testValidationSucceedsForExistingGroupName |
( |
| ) |
|
- Exceptions
-
Definition at line 396 of file ilMailAddressTypesTest.php.
References $type.
398 $logger = $this->getMockBuilder(ilLogger::class)->disableOriginalConstructor()->getMock();
399 $addressTypeHelper = $this->getMockBuilder(ilMailAddressTypeHelper::class)->getMock();
401 $addressTypeHelper->expects($this->once())->method(
'doesGroupNameExists')->with(
'PhpUnit')->willReturn(
true);
408 $this->assertTrue(
$type->validate(666));
Class ilMailGroupAddressType.
The documentation for this class was generated from the following file: