17 if (defined(
'ILIAS_PHPUNIT_CONTEXT'))
19 include_once(
"./Services/PHPUnit/classes/class.ilUnitUtil.php");
20 ilUnitUtil::performInitialisation();
24 chdir( dirname( __FILE__ ) );
32 require_once
'./Modules/TestQuestionPool/classes/class.assAnswerOrdering.php';
37 $this->assertInstanceOf(
'ASS_AnswerOrdering', $instance);
43 require_once
'./Modules/TestQuestionPool/classes/class.assAnswerOrdering.php';
48 $instance->setRandomID($expected);
49 $actual = $instance->getRandomID();
52 $this->assertEquals($expected, $actual);
58 require_once
'./Modules/TestQuestionPool/classes/class.assAnswerOrdering.php';
63 $instance->setAnswerId($expected);
64 $actual = $instance->getAnswerId();
67 $this->assertEquals($expected, $actual);
74 require_once
'./Modules/TestQuestionPool/classes/class.assAnswerOrdering.php';
79 $instance->setOrderingDepth($expected);
80 $actual = $instance->getOrderingDepth();
83 $this->assertEquals($expected, $actual);
89 require_once
'./Modules/TestQuestionPool/classes/class.assAnswerOrdering.php';
94 require_once
'./Services/Database/classes/class.ilDB.php';
95 $ildb_mock = $this->getMock(
'ilDBMySQL', array(
'queryF',
'fetchAssoc'), array(),
'',
false,
false);
96 $ildb_mock->expects( $this->once() )
98 ->with( $this->equalTo(
'SELECT * FROM qpl_a_ordering WHERE random_id = %s'),
99 $this->equalTo(array(
'integer')),
100 $this->equalTo(array($random_id))
102 ->will( $this->returnValue(
'Test') );
103 $ildb_mock->expects( $this->exactly(2) )
104 ->method(
'fetchAssoc' )
105 ->with( $this->equalTo(
'Test') )
106 ->will( $this->onConsecutiveCalls(array(
'answer_id' => 123,
'depth' => 456),
false ) );
111 $instance->getAdditionalOrderingFieldsByRandomId($random_id);
114 $this->assertEquals(123, $instance->getAnswerId());
115 $this->assertEquals(456, $instance->getOrderingDepth());