19 declare(strict_types=1);
    23     protected function setUp(): void
    27         $DIC[
'file_delivery'] = $this->createMock(\
ILIAS\FileDelivery\Services::class);
    32         $defaultPlaceholderValues = $this->getMockBuilder(ilDefaultPlaceholderValues::class)
    33             ->disableOriginalConstructor()
    36         $language = $this->getMockBuilder(ilLanguage::class)
    37             ->disableOriginalConstructor()
    40         $language->method(
'txt')
    41             ->willReturnCallback(
function ($variableValue) {
    42                 if ($variableValue === 
'lang_sep_decimal') {
    44                 } elseif ($variableValue === 
'lang_sep_thousand') {
    48                 return 'Some Translation: ' . $variableValue;
    51         $language->expects($this->once())
    52             ->method(
'loadLanguageModule');
    54         $dateHelper = $this->getMockBuilder(ilCertificateDateHelper::class)
    57         $objectMock = $this->getMockBuilder(ilObjSAHSLearningModule::class)
    58             ->disableOriginalConstructor()
    59             ->onlyMethods([
'getPointsInPercent', 
'getMaxPoints', 
'getTitle', 
'getId'])
    62         $objectMock->method(
'getPointsInPercent')
    65         $objectMock->method(
'getMaxPoints')
    68         $objectMock->method(
'getTitle')
    69             ->willReturn(
'SomeTitle');
    71         $objectMock->method(
'getId')
    74         $objectHelper = $this->getMockBuilder(ilCertificateObjectHelper::class)
    77         $objectHelper->method(
'getInstanceByObjId')
    78             ->willReturn($objectMock);
    80         $utilHelper = $this->getMockBuilder(ilCertificateUtilHelper::class)
    83         $utilHelper->method(
'prepareFormOutput')
    84             ->willReturn(
'Formatted String');
    86         $objectLPHelper = $this->getMockBuilder(ilCertificateObjectLPHelper::class)
    89         $lpCollection = $this->getMockBuilder(ilLPCollectionOfSCOs::class)
    90             ->disableOriginalConstructor()
    91             ->onlyMethods([
'getPossibleItems', 
'getScoresForUserAndCP_Node_Id', 
'isAssignedEntry'])
    94         $lpCollection->method(
'getPossibleItems')
    95             ->willReturn([100 => [
'title' => 
'Some Title']]);
    97         $lpCollection->method(
'getScoresForUserAndCP_Node_Id')
   106         $lpCollection->method(
'isAssignedEntry')
   109         $olp = $this->getMockBuilder(ilObjectLP::class)
   110             ->disableOriginalConstructor()
   111             ->onlyMethods([
'getCollectionInstance'])
   114         $olp->method(
'getCollectionInstance')
   115             ->willReturn($lpCollection);
   117         $objectLPHelper->method(
'getInstance')
   120         $lpStatusHelper = $this->getMockBuilder(ilCertificateLPStatusHelper::class)
   123         $lpStatusHelper->method(
'lookupStatusChanged')
   124             ->willReturn(
'2018-12-01 13:00:11');
   127             $defaultPlaceholderValues,
   136         $result = $scormPlaceholderValues->getPlaceholderValues(10, 200);
   140                 'SCORM_TITLE' => 
'Formatted String',
   141                 'SCORM_POINTS' => 
'100,0 %',
   142                 'SCORM_POINTS_MAX' => 100,
   143                 'SCO_T_0' => 
'Some Title',
   144                 'SCO_P_0' => 
'100,0',
   145                 'SCO_PM_0' => 
'300,0',
   146                 'SCO_PP_0' => 
'200,0 %',
   147                 'DATE_COMPLETED' => 
'',
   148                 'DATETIME_COMPLETED' => 
''   156         $defaultPlaceholderValues = $this->getMockBuilder(ilDefaultPlaceholderValues::class)
   157             ->disableOriginalConstructor()
   160         $defaultPlaceholderValues->method(
'getPlaceholderValuesForPreview')
   163                     'SOME_PLACEHOLDER' => 
'aaa',
   164                     'SOME_OTHER_PLACEHOLDER' => 
'bbb'   168         $language = $this->getMockBuilder(ilLanguage::class)
   169             ->disableOriginalConstructor()
   172         $language->method(
'txt')
   173             ->willReturnCallback(
function ($variableValue) {
   174                 if ($variableValue === 
'lang_sep_decimal') {
   176                 } elseif ($variableValue === 
'lang_sep_thousand') {
   180                 return 'Some Translation: ' . $variableValue;
   183         $dateHelper = $this->getMockBuilder(ilCertificateDateHelper::class)
   186         $objectMock = $this->getMockBuilder(ilObject::class)
   187             ->disableOriginalConstructor()
   190         $objectMock->method(
'getTitle')
   191             ->willReturn(
'Some Title');
   193         $objectHelper = $this->getMockBuilder(ilCertificateObjectHelper::class)
   196         $objectHelper->method(
'getInstanceByObjId')
   197             ->willReturn($objectMock);
   199         $utilHelper = $this->getMockBuilder(ilCertificateUtilHelper::class)
   202         $utilHelper->method(
'prepareFormOutput')
   203             ->willReturnCallback(
function ($input) {
   207         $objectLPHelper = $this->getMockBuilder(ilCertificateObjectLPHelper::class)
   210         $lpCollection = $this->getMockBuilder(ilLPCollectionOfSCOs::class)
   211             ->disableOriginalConstructor()
   212             ->onlyMethods([
'getPossibleItems', 
'isAssignedEntry'])
   215         $lpCollection->method(
'getPossibleItems')
   218                     'title' => 
'Some Title'   221                     'title' => 
'Some Other Title'   225         $lpCollection->method(
'isAssignedEntry')
   228         $objectLPMock = $this->getMockBuilder(ilObjectLP::class)
   229             ->disableOriginalConstructor()
   232         $objectLPMock->method(
'getCollectionInstance')
   233             ->willReturn($lpCollection);
   235         $objectLPHelper->method(
'getInstance')
   236             ->willReturn($objectLPMock);
   238         $lpStatusHelper = $this->getMockBuilder(ilCertificateLPStatusHelper::class)
   242             $defaultPlaceholderValues,
   251         $result = $scormPlaceholderValues->getPlaceholderValuesForPreview(100, 10);
   255                 'SCORM_TITLE' => 
'Some Title',
   256                 'SCORM_POINTS' => 
'80,7 %',
   257                 'SCORM_POINTS_MAX' => 
'90',
   258                 'SCO_T_0' => 
'Some Title',
   260                 'SCO_PM_0' => 
'90,9',
   261                 'SCO_PP_0' => 
'33,3 %',
   262                 'SCO_T_1' => 
'Some Other Title',
   264                 'SCO_PM_1' => 
'90,9',
   265                 'SCO_PP_1' => 
'33,3 %',
   266                 'SOME_PLACEHOLDER' => 
'aaa',
   267                 'SOME_OTHER_PLACEHOLDER' => 
'bbb' 
Interface Observer  Contains several chained tasks and infos about them. 
 
Class ilCertificateBaseTestCase. 
 
testGetPlaceholderValuesForPreview()
 
testGetPlaceholderValues()