Unit tests.  
 More...
Unit tests. 
- Author
 - Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
 
\ 
Definition at line 28 of file assClozeGapTest.php.
 
◆ getDummyTransformationMock()
  
  
      
        
          | assClozeGapTest::getDummyTransformationMock  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
private   | 
  
 
 
◆ setUp()
  
  
      
        
          | assClozeGapTest::setUp  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
protected   | 
  
 
Definition at line 32 of file assClozeGapTest.php.
   34         chdir(__DIR__ . 
'/../../../../');
    38         $util_mock = $this->createMock(
'ilUtil', [
'stripSlashes'], [], 
'', 
false);
    39         $util_mock->expects($this->any())->method(
'stripSlashes')->will($this->returnArgument(0));
    40         $this->setGlobalVariable(
'ilUtils', $util_mock);
  
 
 
◆ test_addGetItem_shouldReturnValueUnchanged()
      
        
          | assClozeGapTest::test_addGetItem_shouldReturnValueUnchanged  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 100 of file assClozeGapTest.php.
  105         $instance->addItem($expected);
   106         $actual = $instance->getItem(0);
   108         $this->assertEquals($expected, $actual);
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
Class for cloze question gaps. 
 
 
 
 
◆ test_addGetItem_shouldReturnValueUnchangedMultiple()
      
        
          | assClozeGapTest::test_addGetItem_shouldReturnValueUnchangedMultiple  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 111 of file assClozeGapTest.php.
  117         $instance->addItem($answer);
   118         $instance->addItem($expected);
   119         $actual = $instance->getItem(0);
   121         $this->assertEquals($expected, $actual);
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
Class for cloze question gaps. 
 
 
 
 
◆ test_addGetItem_shouldReturnValueUnchangedMultiplePlus()
      
        
          | assClozeGapTest::test_addGetItem_shouldReturnValueUnchangedMultiplePlus  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 140 of file assClozeGapTest.php.
  148         $instance->addItem($answer);
   149         $instance->addItem($answer2);
   150         $instance->addItem($answer3);
   151         $instance->addItem($expected);
   152         $actual = $instance->getItem(0);
   154         $this->assertEquals($expected, $actual);
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
Class for cloze question gaps. 
 
 
 
 
◆ test_arrayShuffle_shouldNotReturnArrayUnshuffled()
      
        
          | assClozeGapTest::test_arrayShuffle_shouldNotReturnArrayUnshuffled  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 83 of file assClozeGapTest.php.
   87         $the_unexpected = [
'Killing', 
'Kunkel', 
'Luetzenkirchen',
    88             'Meyer', 
'Jansen', 
'Heyser', 
'Becker'];
    89         $instance->items = $the_unexpected;
    90         $instance->setShuffle(
true);
    91         $theExpected = [
'hua', 
'haaa', 
'some random values'];
    93         $transformationMock = $this->getMockBuilder(Transformation::class)->getMock();
    94         $transformationMock->expects(self::once())->method(
'transform')->with($the_unexpected)->willReturn($theExpected);
    95         $actual = $instance->getItems($transformationMock);
    97         $this->assertEquals($theExpected, $actual);
 Class for cloze question gaps. 
 
 
 
 
◆ test_clearItems_shouldClearItems()
      
        
          | assClozeGapTest::test_clearItems_shouldClearItems  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 274 of file assClozeGapTest.php.
  282         $instance->addItem($item1);
   283         $instance->addItem($item2);
   284         $instance->addItem($item3);
   285         $instance->addItem($item4);
   289         $instance->clearItems();
   290         $actual = $instance->getItemCount();
   292         $this->assertEquals($expected, $actual);
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
Class for cloze question gaps. 
 
 
 
 
◆ test_deleteItem_shouldDeleteGivenItem()
      
        
          | assClozeGapTest::test_deleteItem_shouldDeleteGivenItem  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 256 of file assClozeGapTest.php.
  262         $instance->addItem($item1);
   263         $instance->addItem($item2);
   265         $expected = [
'1' => $item2];
   267         $instance->deleteItem(0);
   269         $actual = $instance->getItemsRaw();
   271         $this->assertEquals($expected, $actual);
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
Class for cloze question gaps. 
 
 
 
 
◆ test_getBestSolutionIndexes_shouldReturnBestSolutionIndexes()
      
        
          | assClozeGapTest::test_getBestSolutionIndexes_shouldReturnBestSolutionIndexes  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 381 of file assClozeGapTest.php.
  389         $instance->addItem($item1);
   390         $instance->addItem($item2);
   391         $instance->addItem($item3);
   392         $instance->addItem($item4);
   394         $expected = [ 0 => 3 ];
   396         $actual = $instance->getBestSolutionIndexes();
   398         $this->assertEquals($expected, $actual);
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
Class for cloze question gaps. 
 
 
 
 
◆ test_getBestSolutionOutput_shouldReturnBestSolutionOutput_CaseNumeric()
      
        
          | assClozeGapTest::test_getBestSolutionOutput_shouldReturnBestSolutionOutput_CaseNumeric  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 457 of file assClozeGapTest.php.
References $DIC, $GLOBALS, and getDummyTransformationMock().
  465         $lng_mock = $this->createMock(
'ilLanguage', [
'txt'], [], 
'', 
false);
   466         $lng_mock->expects($this->any())->method(
'txt')->will($this->returnValue(
'Test'));
   469         $DIC[
'lng'] = $lng_mock;
   472         $instance->addItem($item1);
   473         $instance->addItem($item2);
   474         $instance->addItem($item3);
   475         $instance->addItem($item4);
   481         $this->assertEquals($expected, $actual);
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
Class for cloze question gaps. 
 
getDummyTransformationMock()
 
 
 
 
◆ test_getBestSolutionOutput_shouldReturnBestSolutionOutput_CaseText()
      
        
          | assClozeGapTest::test_getBestSolutionOutput_shouldReturnBestSolutionOutput_CaseText  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 401 of file assClozeGapTest.php.
References $DIC, $GLOBALS, and getDummyTransformationMock().
  409         $lng_mock = $this->createMock(
'ilLanguage', [
'txt'], [], 
'', 
false);
   410         $lng_mock->expects($this->any())->method(
'txt')->will($this->returnValue(
'Test'));
   413         $DIC[
'lng'] = $lng_mock;
   416         $instance->addItem($item1);
   417         $instance->addItem($item2);
   418         $instance->addItem($item3);
   419         $instance->addItem($item4);
   421         $expected = 
'Esther';
   425         $this->assertEquals($expected, $actual);
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
Class for cloze question gaps. 
 
getDummyTransformationMock()
 
 
 
 
◆ test_getBestSolutionOutput_shouldReturnBestSolutionOutput_CaseTextMulti()
      
        
          | assClozeGapTest::test_getBestSolutionOutput_shouldReturnBestSolutionOutput_CaseTextMulti  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 428 of file assClozeGapTest.php.
References $DIC, $GLOBALS, and getDummyTransformationMock().
  436         $lng_mock = $this->createMock(
'ilLanguage', [
'txt'], [], 
'', 
false);
   437         $lng_mock->expects($this->any())->method(
'txt')->will($this->returnValue(
'or'));
   440         $DIC[
'lng'] = $lng_mock;
   443         $instance->setShuffle(
true);
   444         $instance->addItem($item1);
   445         $instance->addItem($item2);
   446         $instance->addItem($item3);
   447         $instance->addItem($item4);
   449         $expected1 = 
'Karl or Esther';
   450         $expected2 = 
'Esther or Karl';
   454         $this->assertTrue(($actual == $expected1) || ($actual == $expected2));
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
Class for cloze question gaps. 
 
getDummyTransformationMock()
 
 
 
 
◆ test_getBestSolutionOutput_shouldReturnEmptyStringOnUnknownType_WhichMakesNoSenseButK()
      
        
          | assClozeGapTest::test_getBestSolutionOutput_shouldReturnEmptyStringOnUnknownType_WhichMakesNoSenseButK  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 484 of file assClozeGapTest.php.
References $DIC, $GLOBALS, and getDummyTransformationMock().
  492         $lng_mock = $this->createMock(
'ilLanguage', [
'txt'], [], 
'', 
false);
   493         $lng_mock->expects($this->any())->method(
'txt')->will($this->returnValue(
'Test'));
   496         $DIC[
'lng'] = $lng_mock;
   499         $instance->addItem($item1);
   500         $instance->addItem($item2);
   501         $instance->addItem($item3);
   502         $instance->addItem($item4);
   508         $this->assertEquals($expected, $actual);
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
Class for cloze question gaps. 
 
getDummyTransformationMock()
 
 
 
 
◆ test_getItem_shouldReturnNullIfNoItemAtGivenIndex()
      
        
          | assClozeGapTest::test_getItem_shouldReturnNullIfNoItemAtGivenIndex  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 124 of file assClozeGapTest.php.
  130         $instance->addItem($answer1);
   131         $instance->addItem($answer2);
   135         $actual = $instance->getItem(2);
   137         $this->assertEquals($expected, $actual);
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
Class for cloze question gaps. 
 
 
 
 
◆ test_getItemCount_shouldReturnCorrectCount()
      
        
          | assClozeGapTest::test_getItemCount_shouldReturnCorrectCount  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 223 of file assClozeGapTest.php.
  232         $instance->addItem($item1);
   233         $instance->addItem($item2);
   234         $instance->addItem($item3);
   235         $instance->addItem($item4);
   236         $actual = $instance->getItemCount();
   238         $this->assertEquals($expected, $actual);
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
Class for cloze question gaps. 
 
 
 
 
◆ test_getItems_shouldReturnItemsAdded()
      
        
          | assClozeGapTest::test_getItems_shouldReturnItemsAdded  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 157 of file assClozeGapTest.php.
  164         $instance->setShuffle(
false);
   165         $expected = [$item1, $item2, $item3, $item4];
   166         $instance->addItem($item1);
   167         $instance->addItem($item2);
   168         $instance->addItem($item3);
   169         $instance->addItem($item4);
   170         $transformationMock = $this->getMockBuilder(Transformation::class)->getMock();
   171         $transformationMock->expects(self::never())->method(
'transform');
   172         $actual = $instance->getItems($transformationMock);
   174         $this->assertEquals($expected, $actual);
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
Class for cloze question gaps. 
 
 
 
 
◆ test_getItemsRaw_shouldReturnItemsAdded()
      
        
          | assClozeGapTest::test_getItemsRaw_shouldReturnItemsAdded  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 205 of file assClozeGapTest.php.
  212         $expected = [$item1, $item2, $item3, $item4];
   214         $instance->addItem($item1);
   215         $instance->addItem($item2);
   216         $instance->addItem($item3);
   217         $instance->addItem($item4);
   218         $actual = $instance->getItemsRaw();
   220         $this->assertEquals($expected, $actual);
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
Class for cloze question gaps. 
 
 
 
 
◆ test_getItemsWithShuffle_shouldReturnItemsAddedShuffled()
      
        
          | assClozeGapTest::test_getItemsWithShuffle_shouldReturnItemsAddedShuffled  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 177 of file assClozeGapTest.php.
  180         $instance->setShuffle(
true);
   192         $shuffledArray = [
'some shuffled array', 
'these values dont matter'];
   194         foreach ($expected as $item) {
   195             $instance->addItem($item);
   198         $transformationMock = $this->getMockBuilder(Transformation::class)->getMock();
   199         $transformationMock->expects(self::once())->method(
'transform')->with($expected)->willReturn($shuffledArray);
   200         $actual = $instance->getItems($transformationMock);
   202         $this->assertEquals($shuffledArray, $actual);
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
Class for cloze question gaps. 
 
 
 
 
◆ test_getMaxWidth_shouldReturnCharacterCountOfLongestAnswertext()
      
        
          | assClozeGapTest::test_getMaxWidth_shouldReturnCharacterCountOfLongestAnswertext  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 361 of file assClozeGapTest.php.
  369         $instance->addItem($item1);
   370         $instance->addItem($item2);
   371         $instance->addItem($item3);
   372         $instance->addItem($item4);
   374         $expected = strlen($item4->getAnswertext());
   376         $actual = $instance->getMaxWidth();
   378         $this->assertEquals($expected, $actual);
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
Class for cloze question gaps. 
 
 
 
 
◆ test_instantiateObject_shouldReturnInstance()
      
        
          | assClozeGapTest::test_instantiateObject_shouldReturnInstance  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 43 of file assClozeGapTest.php.
   47         $this->assertInstanceOf(assClozeGap::class, $instance);
 Class for cloze question gaps. 
 
 
 
 
◆ test_setGetShuffle_shouldReturnUnchangedValue()
      
        
          | assClozeGapTest::test_setGetShuffle_shouldReturnUnchangedValue  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 72 of file assClozeGapTest.php.
   77         $instance->setShuffle($expected);
    78         $actual = $instance->getShuffle();
    80         $this->assertEquals($expected, $actual);
 Class for cloze question gaps. 
 
 
 
 
◆ test_setGetType_shouldReturnUnchangedValue()
      
        
          | assClozeGapTest::test_setGetType_shouldReturnUnchangedValue  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 50 of file assClozeGapTest.php.
   55         $instance->setType($expected);
    56         $actual = $instance->getType();
    58         $this->assertEquals($expected, $actual);
 Class for cloze question gaps. 
 
 
 
 
◆ test_setItemLowerBound_shouldSetItemsAnswerIfBoundTooHigh()
      
        
          | assClozeGapTest::test_setItemLowerBound_shouldSetItemsAnswerIfBoundTooHigh  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 311 of file assClozeGapTest.php.
  316         $instance->addItem($item1);
   320         $instance->setItemLowerBound(0, $expected);
   321         $item_retrieved = $instance->getItem(0);
   322         $actual = $item_retrieved->getLowerBound();
   324         $this->assertNotEquals($expected, $actual);
   325         $this->assertEquals($item_retrieved->getAnswerText(), $actual);
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
Class for cloze question gaps. 
 
 
 
 
◆ test_setItemLowerBound_shouldSetItemsLowerBound()
      
        
          | assClozeGapTest::test_setItemLowerBound_shouldSetItemsLowerBound  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 295 of file assClozeGapTest.php.
  300         $instance->addItem($item1);
   304         $instance->setItemLowerBound(0, $expected);
   305         $item_retrieved = $instance->getItem(0);
   306         $actual = $item_retrieved->getLowerBound();
   308         $this->assertEquals($expected, $actual);
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
Class for cloze question gaps. 
 
 
 
 
◆ test_setItemUpperBound_shouldSetItemsAnswerIfBoundTooLow()
      
        
          | assClozeGapTest::test_setItemUpperBound_shouldSetItemsAnswerIfBoundTooLow  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 344 of file assClozeGapTest.php.
  349         $instance->addItem($item1);
   353         $instance->setItemUpperBound(0, $expected);
   354         $item_retrieved = $instance->getItem(0);
   355         $actual = $item_retrieved->getUpperBound();
   357         $this->assertNotEquals($expected, $actual);
   358         $this->assertEquals($item_retrieved->getAnswerText(), $actual);
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
Class for cloze question gaps. 
 
 
 
 
◆ test_setItemUpperBound_shouldSetItemsUpperBound()
      
        
          | assClozeGapTest::test_setItemUpperBound_shouldSetItemsUpperBound  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 328 of file assClozeGapTest.php.
  333         $instance->addItem($item1);
   337         $instance->setItemUpperBound(0, $expected);
   338         $item_retrieved = $instance->getItem(0);
   339         $actual = $item_retrieved->getUpperBound();
   341         $this->assertEquals($expected, $actual);
 This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
Class for cloze question gaps. 
 
 
 
 
◆ test_setType_shouldSetDefaultIfNotPassed()
      
        
          | assClozeGapTest::test_setType_shouldSetDefaultIfNotPassed  | 
          ( | 
           | ) | 
           | 
        
      
 
Definition at line 61 of file assClozeGapTest.php.
   67         $actual = $instance->getType();
    69         $this->assertEquals($expected, $actual);
 Class for cloze question gaps. 
 
 
 
 
◆ $backupGlobals
  
  
      
        
          | assClozeGapTest::$backupGlobals = false | 
         
       
   | 
  
protected   | 
  
 
 
The documentation for this class was generated from the following file: