19 declare(strict_types=1);
    28         $objectMock = $this->getMockBuilder(ilObjUser::class)
    29             ->disableOriginalConstructor()
    50         $objectMock->expects($this->once())
    52             ->willReturn(
'a_login');
    54         $objectMock->expects($this->once())
    55             ->method(
'getFullname')
    56             ->willReturn(
'Niels Theen');
    58         $objectMock->expects($this->once())
    59             ->method(
'getFirstname')
    60             ->willReturn(
'Niels');
    62         $objectMock->expects($this->once())
    63             ->method(
'getLastname')
    64             ->willReturn(
'Theen');
    66         $objectMock->expects($this->once())
    70         $objectMock->expects($this->once())
    74         $objectMock->expects($this->once())
    75             ->method(
'getBirthday')
    76             ->willReturn(
'2018-10-10');
    78         $objectMock->expects($this->once())
    79             ->method(
'getInstitution')
    82         $objectMock->expects($this->once())
    83             ->method(
'getDepartment')
    86         $objectMock->expects($this->once())
    90         $objectMock->expects($this->once())
    94         $objectMock->expects($this->once())
    95             ->method(
'getZipcode')
    98         $objectMock->expects($this->once())
    99             ->method(
'getCountry')
   102         $objectMock->expects($this->once())
   103             ->method(
'getMatriculation')
   106         $objectHelper = $this->getMockBuilder(ilCertificateObjectHelper::class)
   109         $objectHelper->expects($this->once())
   110             ->method(
'getInstanceByObjId')
   112             ->willReturn($objectMock);
   114         $dateHelper = $this->getMockBuilder(ilCertificateDateHelper::class)
   117         $dateHelper->expects($this->exactly(2))
   118             ->method(
'formatDate')
   119             ->willReturn(
'2018-09-10');
   121         $dateHelper->expects($this->once())
   122             ->method(
'formatDateTime')
   123             ->willReturn(
'2018-09-10 12:01:33');
   125         $language = $this->getMockBuilder(ilLanguage::class)
   126             ->disableOriginalConstructor()
   129         $language->method(
'txt')
   130             ->willReturn(
'Something');
   132         $utilHelper = $this->getMockBuilder(ilCertificateUtilHelper::class)
   133             ->disableOriginalConstructor()
   136         $utilHelper->method(
'prepareFormOutput')
   137             ->willReturnCallback(
function ($input) {
   141         $userDefinePlaceholderMock = $this->getMockBuilder(ilUserDefinedFieldsPlaceholderValues::class)
   142             ->disableOriginalConstructor()
   145         $userDefinePlaceholderMock->method(
'getPlaceholderValues')
   148         $userDefinePlaceholderMock->method(
'getPlaceholderValuesForPreview')
   151         $uuid_factory_mock = $this->getMockBuilder(
ILIAS\
Data\UUID\Factory::class)
   153         $uuid_factory_mock->method(
'uuid4AsString')->willReturn(
'randomUniqueString');
   161             $userDefinePlaceholderMock,
   165         $placeHolderObject->setUserLanguage($language);
   167         $result = $placeHolderObject->getPlaceholderValues(100, 200);
   171                 'CERTIFICATE_ID' => 
'',
   172                 'USER_LOGIN' => 
'a_login',
   173                 'USER_FULLNAME' => 
'Niels Theen',
   174                 'USER_FIRSTNAME' => 
'Niels',
   175                 'USER_LASTNAME' => 
'Theen',
   177                 'USER_SALUTATION' => 
'Something',
   178                 'USER_BIRTHDAY' => 
'2018-09-10',
   179                 'USER_INSTITUTION' => 
'',
   180                 'USER_DEPARTMENT' => 
'',
   183                 'USER_ZIPCODE' => 
'',
   184                 'USER_COUNTRY' => 
'',
   185                 'USER_MATRICULATION' => 
'',
   186                 'DATE_COMPLETED' => 
'',
   187                 'DATETIME_COMPLETED' => 
'',
   188                 'DATE' => 
'2018-09-10',
   189                 'DATETIME' => 
'2018-09-10 12:01:33'   197         $objectHelper = $this->getMockBuilder(ilCertificateObjectHelper::class)
   200         $dateHelper = $this->getMockBuilder(ilCertificateDateHelper::class)
   203         $dateHelper->method(
'formatDate')
   204             ->willReturn(
'2018-09-09');
   206         $dateHelper->method(
'formatDateTime')
   207             ->willReturn(
'2018-09-09 14:00:30');
   209         $language = $this->getMockBuilder(ilLanguage::class)
   210             ->disableOriginalConstructor()
   213         $language->method(
'txt')
   214             ->willReturn(
'Something');
   216         $utilHelper = $this->getMockBuilder(ilCertificateUtilHelper::class)
   217             ->disableOriginalConstructor()
   220         $utilHelper->method(
'prepareFormOutput')
   221             ->willReturnCallback(
function ($input) {
   225         $userDefinePlaceholderMock = $this->getMockBuilder(ilUserDefinedFieldsPlaceholderValues::class)
   226             ->disableOriginalConstructor()
   229         $userDefinePlaceholderMock->method(
'getPlaceholderValues')
   232         $userDefinePlaceholderMock->method(
'getPlaceholderValuesForPreview')
   235         $uuid_factory_mock = $this->getMockBuilder(
ILIAS\
Data\UUID\Factory::class)
   237         $uuid_factory_mock->method(
'uuid4AsString')->willReturn(
'randomUniqueString');
   245             $userDefinePlaceholderMock,
   250         $result = $placeHolderObject->getPlaceholderValuesForPreview(
   257                 'CERTIFICATE_ID' => 
'randomUniqueString',
   258                 'USER_LOGIN' => 
'Something',
   259                 'USER_FULLNAME' => 
'Something',
   260                 'USER_FIRSTNAME' => 
'Something',
   261                 'USER_LASTNAME' => 
'Something',
   262                 'USER_TITLE' => 
'Something',
   263                 'USER_SALUTATION' => 
'Something',
   264                 'USER_BIRTHDAY' => 
'2018-09-09',
   265                 'USER_INSTITUTION' => 
'Something',
   266                 'USER_DEPARTMENT' => 
'Something',
   267                 'USER_STREET' => 
'Something',
   268                 'USER_CITY' => 
'Something',
   269                 'USER_ZIPCODE' => 
'Something',
   270                 'USER_COUNTRY' => 
'Something',
   271                 'USER_MATRICULATION' => 
'Something',
   272                 'DATE' => 
'2018-09-09',
   273                 'DATETIME' => 
'2018-09-09 14:00:30',
   274                 'DATE_COMPLETED' => 
'2018-09-09',
   275                 'DATETIME_COMPLETED' => 
'2018-09-09 14:00:30' 
Interface Observer  Contains several chained tasks and infos about them. 
 
testGetPlaceholderValues()
 
Class ilCertificateBaseTestCase. 
 
testGetPlaceholderValuesForPreview()