{
require_once './Modules/TestQuestionPool/classes/class.assAnswerOrdering.php';
$random_id = 13579;
require_once './Services/Database/classes/class.ilDB.php';
$ildb_mock = $this->getMock('ilDBMySQL', array('queryF', 'fetchAssoc'), array(), '', false, false);
$ildb_mock->expects( $this->once() )
->method( 'queryF' )
->with( $this->equalTo('SELECT * FROM qpl_a_ordering WHERE random_id = %s'),
$this->equalTo(array('integer')),
$this->equalTo(array($random_id))
)
->will( $this->returnValue('Test') );
$ildb_mock->expects( $this->exactly(2) )
->method( 'fetchAssoc' )
->with( $this->equalTo('Test') )
->will( $this->onConsecutiveCalls(array('answer_id' => 123, 'depth' => 456), false ) );
global $ilDB;
$ilDB = $ildb_mock;
$instance->getAdditionalOrderingFieldsByRandomId($random_id);
$this->assertEquals(123, $instance->getAnswerId());
$this->assertEquals(456, $instance->getOrderingDepth());
}