11        $defaultPlaceholderValues = $this->getMockBuilder(
'ilDefaultPlaceholderValues')
 
   12            ->disableOriginalConstructor()
 
   15        $language = $this->getMockBuilder(
'ilLanguage')
 
   16            ->disableOriginalConstructor()
 
   20            ->willReturnCallback(
function ($variableValue) {
 
   21                if ($variableValue === 
'lang_sep_decimal') {
 
   23                } elseif ($variableValue === 
'lang_sep_thousand') {
 
   27                return 'Some Translation: ' . $variableValue;
 
   31            ->method(
'loadLanguageModule');
 
   33        $dateHelper = $this->getMockBuilder(
'ilCertificateDateHelper')
 
   36        $objectMock = $this->getMockBuilder(
'ilObject')
 
   37            ->disableOriginalConstructor()
 
   38            ->setMethods(array(
'getPointsInPercent', 
'getMaxPoints', 
'getTitle', 
'getId'))
 
   41        $objectMock->method(
'getPointsInPercent')
 
   44        $objectMock->method(
'getMaxPoints')
 
   47        $objectMock->method(
'getTitle')
 
   48            ->willReturn(
'SomeTitle');
 
   50        $objectMock->method(
'getId')
 
   53        $objectHelper = $this->getMockBuilder(
'ilCertificateObjectHelper')
 
   56        $objectHelper->method(
'getInstanceByObjId')
 
   57            ->willReturn($objectMock);
 
   59        $utilHelper = $this->getMockBuilder(
'ilCertificateUtilHelper')
 
   62        $utilHelper->method(
'prepareFormOutput')
 
   63            ->willReturn(
'Formatted String');
 
   65        $objectLPHelper = $this->getMockBuilder(
'ilCertificateObjectLPHelper')
 
   68        $lpCollection = $this->getMockBuilder(
'ilLPCollection')
 
   69            ->disableOriginalConstructor()
 
   70            ->setMethods(array(
'getPossibleItems', 
'getScoresForUserAndCP_Node_Id', 
'isAssignedEntry'))
 
   73        $lpCollection->method(
'getPossibleItems')
 
   74            ->willReturn(array(100 => array(
'title' => 
'Some Title')));
 
   76        $lpCollection->method(
'getScoresForUserAndCP_Node_Id')
 
   85        $lpCollection->method(
'isAssignedEntry')
 
   88        $olp = $this->getMockBuilder(
'ilObjectLP')
 
   89            ->disableOriginalConstructor()
 
   90            ->setMethods(array(
'getCollectionInstance'))
 
   93        $olp->method(
'getCollectionInstance')
 
   94            ->willReturn($lpCollection);
 
   96        $objectLPHelper->method(
'getInstance')
 
   99        $lpStatusHelper = $this->getMockBuilder(
'ilCertificateLPStatusHelper')
 
  102        $lpStatusHelper->method(
'lookupStatusChanged')
 
  103            ->willReturn(
'2018-12-01 13:00:11');
 
  106            $defaultPlaceholderValues,
 
  115        $result = $scormPlaceholderValues->getPlaceholderValues(10, 200);
 
  119                'SCORM_TITLE' => 
'Formatted String',
 
  120                'SCORM_POINTS' => 
'100,0 %',
 
  121                'SCORM_POINTS_MAX' => 100,
 
  122                'SCO_T_0' => 
'Some Title',
 
  123                'SCO_P_0' => 
'100,0',
 
  124                'SCO_PM_0' => 
'300,0',
 
  125                'SCO_PP_0' => 
'200,0 %',
 
  126                'DATE_COMPLETED' => 
'',
 
  127                'DATETIME_COMPLETED' => 
'' 
  135        $defaultPlaceholderValues = $this->getMockBuilder(
'ilDefaultPlaceholderValues')
 
  136            ->disableOriginalConstructor()
 
  139        $defaultPlaceholderValues->method(
'getPlaceholderValuesForPreview')
 
  142                    'SOME_PLACEHOLDER' => 
'aaa',
 
  143                    'SOME_OTHER_PLACEHOLDER' => 
'bbb' 
  147        $language = $this->getMockBuilder(
'ilLanguage')
 
  148            ->disableOriginalConstructor()
 
  152            ->willReturnCallback(
function ($variableValue) {
 
  153                if ($variableValue === 
'lang_sep_decimal') {
 
  155                } elseif ($variableValue === 
'lang_sep_thousand') {
 
  159                return 'Some Translation: ' . $variableValue;
 
  162        $dateHelper = $this->getMockBuilder(
'ilCertificateDateHelper')
 
  165        $objectMock = $this->getMockBuilder(
'ilObject')
 
  166            ->disableOriginalConstructor()
 
  169        $objectMock->method(
'getTitle')
 
  170            ->willReturn(
'Some Title');
 
  172        $objectHelper = $this->getMockBuilder(
'ilCertificateObjectHelper')
 
  175        $objectHelper->method(
'getInstanceByObjId')
 
  176            ->willReturn($objectMock);
 
  178        $utilHelper = $this->getMockBuilder(
'ilCertificateUtilHelper')
 
  181        $utilHelper->method(
'prepareFormOutput')
 
  182            ->willReturnCallback(
function (
$input) {
 
  186        $objectLPHelper = $this->getMockBuilder(
'ilCertificateObjectLPHelper')
 
  189        $lpCollection = $this->getMockBuilder(
'ilLPCollection')
 
  190            ->disableOriginalConstructor()
 
  191            ->setMethods(array(
'getPossibleItems', 
'isAssignedEntry'))
 
  194        $lpCollection->method(
'getPossibleItems')
 
  197                    'title' => 
'Some Title' 
  200                    'title' => 
'Some Other Title' 
  204        $lpCollection->method(
'isAssignedEntry')
 
  207        $objectLPMock = $this->getMockBuilder(
'ilObjectLP')
 
  208            ->disableOriginalConstructor()
 
  211        $objectLPMock->method(
'getCollectionInstance')
 
  212            ->willReturn($lpCollection);
 
  214        $objectLPHelper->method(
'getInstance')
 
  215            ->willReturn($objectLPMock);
 
  217        $lpStatusHelper = $this->getMockBuilder(
'ilCertificateLPStatusHelper')
 
  221            $defaultPlaceholderValues,
 
  230        $result = $scormPlaceholderValues->getPlaceholderValuesForPreview(100, 10);
 
  234                'SCORM_TITLE' => 
'Some Title',
 
  235                'SCORM_POINTS' => 
'80,7 %',
 
  236                'SCORM_POINTS_MAX' => 
'90',
 
  237                'SCO_T_0' => 
'Some Title',
 
  239                'SCO_PM_0' => 
'90,9',
 
  240                'SCO_PP_0' => 
'33,3 %',
 
  241                'SCO_T_1' => 
'Some Other Title',
 
  243                'SCO_PM_1' => 
'90,9',
 
  244                'SCO_PP_1' => 
'33,3 %',
 
  245                'SOME_PLACEHOLDER' => 
'aaa',
 
  246                'SOME_OTHER_PLACEHOLDER' => 
'bbb' 
An exception for terminatinating execution or to throw for unit testing.
testGetPlaceholderValues()
testGetPlaceholderValuesForPreview()
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.