ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
assAnswerOrderingTest Class Reference

Unit tests. More...

+ Inheritance diagram for assAnswerOrderingTest:
+ Collaboration diagram for assAnswerOrderingTest:

Public Member Functions

 test_instantiateObject_shouldReturnInstance ()
 test_setGetRandomId ()
 test_setGetAnswerId ()
 test_setGetOrdeingDepth ()
 test_getAdditionalOrderingFieldsByRandomId ()

Protected Member Functions

 setUp ()

Protected Attributes

 $backupGlobals = FALSE

Detailed Description

Unit tests.

Author
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de

Definition at line 11 of file assAnswerOrderingTest.php.

Member Function Documentation

assAnswerOrderingTest::setUp ( )
protected

Definition at line 15 of file assAnswerOrderingTest.php.

{
if (defined('ILIAS_PHPUNIT_CONTEXT'))
{
include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
ilUnitUtil::performInitialisation();
}
else
{
chdir( dirname( __FILE__ ) );
chdir('../../../');
}
}
assAnswerOrderingTest::test_getAdditionalOrderingFieldsByRandomId ( )

Definition at line 86 of file assAnswerOrderingTest.php.

{
// Arrange
require_once './Modules/TestQuestionPool/classes/class.assAnswerOrdering.php';
$instance = new ASS_AnswerOrdering();
$random_id = 13579;
//require_once './Services/PEAR/lib/MDB2.php';
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;
// Act
$instance->getAdditionalOrderingFieldsByRandomId($random_id);
// Assert
$this->assertEquals(123, $instance->getAnswerId());
$this->assertEquals(456, $instance->getOrderingDepth());
}
assAnswerOrderingTest::test_instantiateObject_shouldReturnInstance ( )

Definition at line 29 of file assAnswerOrderingTest.php.

{
// Arrange
require_once './Modules/TestQuestionPool/classes/class.assAnswerOrdering.php';
// Act
$instance = new ASS_AnswerOrdering();
$this->assertInstanceOf('ASS_AnswerOrdering', $instance);
}
assAnswerOrderingTest::test_setGetAnswerId ( )

Definition at line 55 of file assAnswerOrderingTest.php.

{
// Arrange
require_once './Modules/TestQuestionPool/classes/class.assAnswerOrdering.php';
$instance = new ASS_AnswerOrdering();
$expected = 13579;
// Act
$instance->setAnswerId($expected);
$actual = $instance->getAnswerId();
// Assert
$this->assertEquals($expected, $actual);
}
assAnswerOrderingTest::test_setGetOrdeingDepth ( )

Definition at line 71 of file assAnswerOrderingTest.php.

{
// Arrange
require_once './Modules/TestQuestionPool/classes/class.assAnswerOrdering.php';
$instance = new ASS_AnswerOrdering();
$expected = 13579;
// Act
$instance->setOrderingDepth($expected);
$actual = $instance->getOrderingDepth();
// Assert
$this->assertEquals($expected, $actual);
}
assAnswerOrderingTest::test_setGetRandomId ( )

Definition at line 40 of file assAnswerOrderingTest.php.

{
// Arrange
require_once './Modules/TestQuestionPool/classes/class.assAnswerOrdering.php';
$instance = new ASS_AnswerOrdering();
$expected = 13579;
// Act
$instance->setRandomID($expected);
$actual = $instance->getRandomID();
// Assert
$this->assertEquals($expected, $actual);
}

Field Documentation

assAnswerOrderingTest::$backupGlobals = FALSE
protected

Definition at line 13 of file assAnswerOrderingTest.php.


The documentation for this class was generated from the following file: