ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilMailAddressTypesTest Class Reference
+ Inheritance diagram for ilMailAddressTypesTest:
+ Collaboration diagram for ilMailAddressTypesTest:

Public Member Functions

 setUp ()
 
 testFactoryWillReturnListAddressTypeForListName ()
 
 testFactoryWillReturnGroupAddressTypeForGroupName ()
 
 testFactoryWillReturnLoginOrEmailAddressAddressType ()
 
 testFactoryWillReturnRoleAddressType ()
 
 testAdminGroupNameIsAValidMailAddressTypes ()
 
 testMemberGroupNameIsAValidMailAddressType ()
 
 testAdminCourseNameIsAValidMailAddressType ()
 
 testMemberCourseNameIsAValidMailAddressType ()
 

Private Member Functions

 createGroupNameAsValidatorMock ()
 

Additional Inherited Members

- Protected Member Functions inherited from ilMailBaseTest
 setUp ()
 
 setGlobalVariable ($name, $value)
 

Detailed Description

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de

Definition at line 7 of file ilMailAddressTypesTest.php.

Member Function Documentation

◆ createGroupNameAsValidatorMock()

ilMailAddressTypesTest::createGroupNameAsValidatorMock ( )
private

Definition at line 126 of file ilMailAddressTypesTest.php.

References array.

Referenced by testAdminCourseNameIsAValidMailAddressType(), testAdminGroupNameIsAValidMailAddressTypes(), testFactoryWillReturnGroupAddressTypeForGroupName(), testFactoryWillReturnListAddressTypeForListName(), testFactoryWillReturnLoginOrEmailAddressAddressType(), testFactoryWillReturnRoleAddressType(), testMemberCourseNameIsAValidMailAddressType(), and testMemberGroupNameIsAValidMailAddressType().

127  {
128  return $this->getMockBuilder('ilGroupNameAsMailValidator')
129  ->disableOriginalConstructor()
130  ->setMethods(array('validate'))
131  ->getMock();
132  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ setUp()

ilMailAddressTypesTest::setUp ( )

Definition at line 9 of file ilMailAddressTypesTest.php.

References $result, array, and ilMailBaseTest\setGlobalVariable().

10  {
11  parent::setUp();
12 
13  $user = $this->getMockBuilder('ilObjUser')->disableOriginalConstructor()->setMethods(array('getId'))->getMock();
14  $user->expects($this->any())->method('getId')->will($this->returnValue(6));
15 
16  $rbacsystem = $this->getMockBuilder('ilRbacSystem')->disableOriginalConstructor()->getMock();
17  $rbacreview = $this->getMockBuilder('ilRbacReview')->disableOriginalConstructor()->getMock();
18 
19  $this->setGlobalVariable('rbacreview', $rbacreview);
20  $this->setGlobalVariable('rbacsystem', $rbacsystem);
21  $this->setGlobalVariable('ilUser', $user);
22 
23  $database = $this->getMockBuilder('ilDBInterface')->getMock();
24  $result = $this->getMockBuilder('ilDBStatement')->getMock();
25  $result->expects($this->any())->method('numRows')->will($this->returnValue(1));
26  $database->expects($this->any())->method('query')->will($this->returnValue($result));
27  $this->setGlobalVariable('ilDB', $database);
28  }
$result
Create styles array
The data for the language used.
setGlobalVariable($name, $value)
+ Here is the call graph for this function:

◆ testAdminCourseNameIsAValidMailAddressType()

ilMailAddressTypesTest::testAdminCourseNameIsAValidMailAddressType ( )

Definition at line 102 of file ilMailAddressTypesTest.php.

References $result, and createGroupNameAsValidatorMock().

103  {
104  $groupNameValidatorMock = $this->createGroupNameAsValidatorMock();
105  $groupNameValidatorMock->method('validate')->willReturn(false);
106 
107  $mailAddressTypeFactory = new ilMailAddressTypeFactory($groupNameValidatorMock);
108 
109  $result = $mailAddressTypeFactory->getByPrefix(new ilMailAddress('#il_crs_admin_98', ''));
110 
111  $this->assertInstanceOf('ilMailRoleAddressType', $result);
112  }
$result
Class ilMailAddressTypeFactory.
Class ilMailAddress.
+ Here is the call graph for this function:

◆ testAdminGroupNameIsAValidMailAddressTypes()

ilMailAddressTypesTest::testAdminGroupNameIsAValidMailAddressTypes ( )

Definition at line 78 of file ilMailAddressTypesTest.php.

References $result, and createGroupNameAsValidatorMock().

79  {
80  $groupNameValidatorMock = $this->createGroupNameAsValidatorMock();
81  $groupNameValidatorMock->method('validate')->willReturn(false);
82 
83  $mailAddressTypeFactory = new ilMailAddressTypeFactory($groupNameValidatorMock);
84 
85  $result = $mailAddressTypeFactory->getByPrefix(new ilMailAddress('#il_grp_admin_98', ''));
86 
87  $this->assertInstanceOf('ilMailRoleAddressType', $result);
88  }
$result
Class ilMailAddressTypeFactory.
Class ilMailAddress.
+ Here is the call graph for this function:

◆ testFactoryWillReturnGroupAddressTypeForGroupName()

ilMailAddressTypesTest::testFactoryWillReturnGroupAddressTypeForGroupName ( )

Definition at line 42 of file ilMailAddressTypesTest.php.

References $result, and createGroupNameAsValidatorMock().

43  {
44  $groupNameValidatorMock = $this->createGroupNameAsValidatorMock();
45  $groupNameValidatorMock->method('validate')->willReturn(true);
46 
47  $mailAddressTypeFactory = new ilMailAddressTypeFactory($groupNameValidatorMock);
48 
49  $result = $mailAddressTypeFactory->getByPrefix(new ilMailAddress('#MyGroup', ''));
50 
51  $this->assertInstanceOf('ilMailGroupAddressType', $result);
52  }
$result
Class ilMailAddressTypeFactory.
Class ilMailAddress.
+ Here is the call graph for this function:

◆ testFactoryWillReturnListAddressTypeForListName()

ilMailAddressTypesTest::testFactoryWillReturnListAddressTypeForListName ( )

Definition at line 30 of file ilMailAddressTypesTest.php.

References $result, and createGroupNameAsValidatorMock().

31  {
32  $groupNameValidatorMock = $this->createGroupNameAsValidatorMock();
33  $groupNameValidatorMock->method('validate')->willReturn(true);
34 
35  $mailAddressTypeFactory = new ilMailAddressTypeFactory($groupNameValidatorMock);
36 
37  $result = $mailAddressTypeFactory->getByPrefix(new ilMailAddress('#il_ml_4711', ''));
38 
39  $this->assertInstanceOf('ilMailMailingListAddressType', $result);
40  }
$result
Class ilMailAddressTypeFactory.
Class ilMailAddress.
+ Here is the call graph for this function:

◆ testFactoryWillReturnLoginOrEmailAddressAddressType()

ilMailAddressTypesTest::testFactoryWillReturnLoginOrEmailAddressAddressType ( )

Definition at line 54 of file ilMailAddressTypesTest.php.

References $result, and createGroupNameAsValidatorMock().

55  {
56  $groupNameValidatorMock = $this->createGroupNameAsValidatorMock();
57  $groupNameValidatorMock->method('validate')->willReturn(false);
58 
59  $mailAddressTypeFactory = new ilMailAddressTypeFactory($groupNameValidatorMock);
60 
61  $result = $mailAddressTypeFactory->getByPrefix(new ilMailAddress('phpunit', ''));
62 
63  $this->assertInstanceOf('ilMailLoginOrEmailAddressAddressType', $result);
64  }
$result
Class ilMailAddressTypeFactory.
Class ilMailAddress.
+ Here is the call graph for this function:

◆ testFactoryWillReturnRoleAddressType()

ilMailAddressTypesTest::testFactoryWillReturnRoleAddressType ( )

Definition at line 66 of file ilMailAddressTypesTest.php.

References $result, and createGroupNameAsValidatorMock().

67  {
68  $groupNameValidatorMock = $this->createGroupNameAsValidatorMock();
69  $groupNameValidatorMock->method('validate')->willReturn(false);
70 
71  $mailAddressTypeFactory = new ilMailAddressTypeFactory($groupNameValidatorMock);
72 
73  $result = $mailAddressTypeFactory->getByPrefix(new ilMailAddress('#member', ''));
74 
75  $this->assertInstanceOf('ilMailRoleAddressType', $result);
76  }
$result
Class ilMailAddressTypeFactory.
Class ilMailAddress.
+ Here is the call graph for this function:

◆ testMemberCourseNameIsAValidMailAddressType()

ilMailAddressTypesTest::testMemberCourseNameIsAValidMailAddressType ( )

Definition at line 114 of file ilMailAddressTypesTest.php.

References $result, and createGroupNameAsValidatorMock().

115  {
116  $groupNameValidatorMock = $this->createGroupNameAsValidatorMock();
117  $groupNameValidatorMock->method('validate')->willReturn(false);
118 
119  $mailAddressTypeFactory = new ilMailAddressTypeFactory($groupNameValidatorMock);
120 
121  $result = $mailAddressTypeFactory->getByPrefix(new ilMailAddress('#il_crs_member_98', ''));
122 
123  $this->assertInstanceOf('ilMailRoleAddressType', $result);
124  }
$result
Class ilMailAddressTypeFactory.
Class ilMailAddress.
+ Here is the call graph for this function:

◆ testMemberGroupNameIsAValidMailAddressType()

ilMailAddressTypesTest::testMemberGroupNameIsAValidMailAddressType ( )

Definition at line 90 of file ilMailAddressTypesTest.php.

References $result, and createGroupNameAsValidatorMock().

91  {
92  $groupNameValidatorMock = $this->createGroupNameAsValidatorMock();
93  $groupNameValidatorMock->method('validate')->willReturn(false);
94 
95  $mailAddressTypeFactory = new ilMailAddressTypeFactory($groupNameValidatorMock);
96 
97  $result = $mailAddressTypeFactory->getByPrefix(new ilMailAddress('#il_grp_member_98', ''));
98 
99  $this->assertInstanceOf('ilMailRoleAddressType', $result);
100  }
$result
Class ilMailAddressTypeFactory.
Class ilMailAddress.
+ Here is the call graph for this function:

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