17                if (defined(
'ILIAS_PHPUNIT_CONTEXT'))
 
   19                        include_once(
"./Services/PHPUnit/classes/class.ilUnitUtil.php");
 
   20                        ilUnitUtil::performInitialisation();
 
   24                        chdir( dirname( __FILE__ ) );
 
   27                        require_once 
'./Services/UICore/classes/class.ilCtrl.php';
 
   28                        $ilCtrl_mock = $this->getMock(
'ilCtrl');
 
   29                        $ilCtrl_mock->expects( $this->any() )->method( 
'saveParameter' );
 
   30                        $ilCtrl_mock->expects( $this->any() )->method( 
'saveParameterByClass' );
 
   34                        require_once 
'./Services/Language/classes/class.ilLanguage.php';
 
   35                        $lng_mock = $this->getMock(
'ilLanguage', array(
'txt'), array(), 
'', 
false);
 
   40                        $ilias_mock = 
new stdClass();
 
   41                        $ilias_mock->account = 
new stdClass();
 
   42                        $ilias_mock->account->id = 6;
 
   43                        $ilias_mock->account->fullname = 
'Esther Tester';
 
   52                require_once 
'./Modules/TestQuestionPool/classes/class.assErrorText.php';
 
   58                $this->assertInstanceOf(
'assErrorText', $instance);
 
   64                require_once 
'./Modules/TestQuestionPool/classes/class.assErrorText.php';
 
   68                        Eine ((Kündigung)) kommt durch zwei gleichlautende Willenserklärungen zustande. 
   69                        Ein Vertrag kommt durch ((drei gleichlaute)) Willenserklärungen zustande. 
   70                        Ein Kaufvertrag an der Kasse im #Supermarkt kommt durch das legen von Ware auf das 
   71                        Kassierband und den Kassiervorgang zustande. Dies nennt man ((konsequentes)) Handeln.';
 
   74                        'passages'  => array( 0 => 
'Kündigung',  1=> 
'drei gleichlaute', 3 => 
'konsequentes'),
 
   75                        'words'     => array( 2 => 
'Supermarkt')
 
   79                $actual = $instance->getErrorsFromText($errortext);
 
   82                $this->assertEquals($expected, $actual);
 
   88                require_once 
'./Modules/TestQuestionPool/classes/class.assErrorText.php';
 
   92                        Eine Kündigung)) kommt durch zwei gleichlautende (Willenserklärungen) zustande. 
   93                        Ein Vertrag kommt durch (drei gleichlaute) Willenserklärungen zustande. 
   94                        Ein Kaufvertrag an der Kasse im Supermarkt [kommt] durch das legen von Ware auf das 
   95                        Kassierband und den [[Kassiervorgang]] zustande. Dies nennt man *konsequentes Handeln.';
 
  100                $actual = $instance->getErrorsFromText($errortext);
 
  103                $this->assertEquals($expected, $actual);
 
  109                require_once 
'./Modules/TestQuestionPool/classes/class.assErrorText.php';
 
  113                        Eine ((Kündigung)) kommt durch zwei gleichlautende Willenserklärungen zustande. 
  114                        Ein Vertrag kommt durch ((drei gleichlaute)) Willenserklärungen zustande. 
  115                        Ein Kaufvertrag an der Kasse im #Supermarkt kommt durch das legen von Ware auf das 
  116                        Kassierband und den Kassiervorgang zustande. Dies nennt man ((konsequentes)) Handeln.';
 
  119                        'passages'  => array( 0 => 
'Kündigung',  1=> 
'drei gleichlaute', 3 => 
'konsequentes'),
 
  120                        'words'     => array( 2 => 
'Supermarkt')
 
  124                $instance->setErrorText($errortext);
 
  125                $actual = $instance->getErrorsFromText(
'');
 
  128                $this->assertEquals($expected, $actual);
 
  134                require_once 
'./Modules/TestQuestionPool/classes/class.assErrorText.php';
 
  137                $errordata = array (
'passages' => array ( 0 => 
'drei Matrosen'), 
'words' => array());
 
  138                require_once 
"./Modules/TestQuestionPool/classes/class.assAnswerErrorText.php";
 
  142                $instance->setErrorData($errordata);
 
  144                $all_errors = $instance->getErrorData();
 
  145                $actual = $all_errors[0];
 
  148                $this->assertEquals($expected, $actual);
 
  154                require_once 
'./Modules/TestQuestionPool/classes/class.assErrorText.php';
 
  157                $errordata = array (
'passages' => array ( 0 => 
'drei Matrosen'), 
'words' => array());
 
  158                require_once 
"./Modules/TestQuestionPool/classes/class.assAnswerErrorText.php";
 
  160                $instance->errordata = $expected;
 
  163                $instance->setErrorData($errordata);
 
  165                $all_errors = $instance->getErrorData();
 
  166                $actual = $all_errors[0];
 
  169                $this->assertEquals($expected, $actual);
 
Class for error text answers.
Unit tests for assErrorTextTest.
test_getErrorsFromText_emptyArgShouldPullInternal()
test_instantiateObjectSimple()
test_setErrordata_oldErrordataPresent()
test_getErrorsFromText_noMatch()
test_setErrordata_newError()
Class for error text questions.