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

Unit tests. More...

+ Inheritance diagram for assAnswerSimpleTest:
+ Collaboration diagram for assAnswerSimpleTest:

Public Member Functions

 test_instantiateObject_shouldReturnInstance ()
 test_setGetId_shouldReturnUnchangedId ()
 test_setGetAnswertext_shouldReturnUnchangedAnswertext ()
 test_setGetPoints_shouldReturnUnchangedPoints ()
 test_setGetPoints_shouldReturnUnchangedZeroOnNonNumericInput ()
 test_setGetOrder_shouldReturnUnchangedOrder ()

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 assAnswerSimpleTest.php.

Member Function Documentation

assAnswerSimpleTest::setUp ( )
protected

Definition at line 15 of file assAnswerSimpleTest.php.

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

Definition at line 29 of file assAnswerSimpleTest.php.

{
// Arrange
require_once './Modules/TestQuestionPool/classes/class.assAnswerSimple.php';
// Act
$instance = new ASS_AnswerSimple();
$this->assertInstanceOf('ASS_AnswerSimple', $instance);
}
assAnswerSimpleTest::test_setGetAnswertext_shouldReturnUnchangedAnswertext ( )

Definition at line 55 of file assAnswerSimpleTest.php.

{
// Arrange
require_once './Modules/TestQuestionPool/classes/class.assAnswerSimple.php';
$instance = new ASS_AnswerSimple();
$expected = 'The answer, of course, is 42.';
// Act
$instance->setAnswertext($expected);
$actual = $instance->getAnswertext();
// Assert
$this->assertEquals($expected, $actual);
}
assAnswerSimpleTest::test_setGetId_shouldReturnUnchangedId ( )

Definition at line 40 of file assAnswerSimpleTest.php.

{
// Arrange
require_once './Modules/TestQuestionPool/classes/class.assAnswerSimple.php';
$instance = new ASS_AnswerSimple();
$expected = 1;
// Act
$instance->setId($expected);
$actual = $instance->getId();
// Assert
$this->assertEquals($expected, $actual);
}
assAnswerSimpleTest::test_setGetOrder_shouldReturnUnchangedOrder ( )

Definition at line 102 of file assAnswerSimpleTest.php.

{
// Arrange
require_once './Modules/TestQuestionPool/classes/class.assAnswerSimple.php';
$instance = new ASS_AnswerSimple();
$expected = 42;
// Act
$instance->setOrder($expected);
$actual = $instance->getOrder();
// Assert
$this->assertEquals($expected, $actual);
}
assAnswerSimpleTest::test_setGetPoints_shouldReturnUnchangedPoints ( )

Definition at line 70 of file assAnswerSimpleTest.php.

{
// Arrange
require_once './Modules/TestQuestionPool/classes/class.assAnswerSimple.php';
$instance = new ASS_AnswerSimple();
$expected = 42;
// Act
$instance->setPoints($expected);
$actual = $instance->getPoints();
// Assert
$this->assertEquals($expected, $actual);
}
assAnswerSimpleTest::test_setGetPoints_shouldReturnUnchangedZeroOnNonNumericInput ( )

Definition at line 85 of file assAnswerSimpleTest.php.

{
// Note: We want to get rid of this functionality in the class.
// Arrange
require_once './Modules/TestQuestionPool/classes/class.assAnswerSimple.php';
$instance = new ASS_AnswerSimple();
$expected = 0.0;
// Act
$instance->setPoints('Günther');
$actual = $instance->getPoints();
// Assert
$this->assertEquals($expected, $actual);
}

Field Documentation

assAnswerSimpleTest::$backupGlobals = FALSE
protected

Definition at line 13 of file assAnswerSimpleTest.php.


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