ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
assAnswerOrderingTest.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3require_once 'Services/Database/interfaces/interface.ilDBInterface.php';
12{
13 protected $backupGlobals = false;
14
15 protected function setUp()
16 {
17 if (defined('ILIAS_PHPUNIT_CONTEXT')) {
18 include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
19 ilUnitUtil::performInitialisation();
20 } else {
21 chdir(dirname(__FILE__));
22 chdir('../../../');
23 }
24 }
25
27 {
28 // Arrange
29 require_once './Modules/TestQuestionPool/classes/questions/class.ilAssOrderingElement.php';
30
31 // Act
32 $instance = new ilAssOrderingElement();
33
34 $this->assertInstanceOf('ilAssOrderingElement', $instance);
35 }
36
37 public function test_setGetRandomId()
38 {
39 // Arrange
40 require_once './Modules/TestQuestionPool/classes/questions/class.ilAssOrderingElement.php';
41 $instance = new ilAssOrderingElement();
42 $expected = 13579;
43
44 // Act
45 $instance->setRandomIdentifier($expected);
46 $actual = $instance->getRandomIdentifier();
47
48 // Assert
49 $this->assertEquals($expected, $actual);
50 }
51
52 public function test_setGetAnswerId()
53 {
54 // Arrange
55 require_once './Modules/TestQuestionPool/classes/questions/class.ilAssOrderingElement.php';
56 $instance = new ilAssOrderingElement();
57 $expected = 13579;
58
59 // Act
60 $instance->setId($expected);
61 $actual = $instance->getId();
62
63 // Assert
64 $this->assertEquals($expected, $actual);
65 }
66
67
68 public function test_setGetOrdeingDepth()
69 {
70 // Arrange
71 require_once './Modules/TestQuestionPool/classes/questions/class.ilAssOrderingElement.php';
72 $instance = new ilAssOrderingElement();
73 $expected = 13579;
74
75 // Act
76 $instance->setIndentation($expected);
77 $actual = $instance->getIndentation();
78
79 // Assert
80 $this->assertEquals($expected, $actual);
81 }
82}
An exception for terminatinating execution or to throw for unit testing.