ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilQTIParserTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
24 
25 class ilQTIParserTest extends TestCase
26 {
27  public function testConstruct(): void
28  {
29  $this->assertInstanceOf(ilQTIParser::class, new ilQTIParser('dummy xml file'));
30  }
31 
32  public function testSetGetQuestionSetType(): void
33  {
34  $instance = new ilQTIParser('dummy xml file');
35  $instance->setQuestionSetType('Some input.');
36  $this->assertEquals('Some input.', $instance->getQuestionSetType());
37  }
38 
39  public function testSetTestObject(): void
40  {
41  $id = 8098;
42  $test = $this->getMockBuilder(ilObjTest::class)->disableOriginalConstructor()->getMock();
43  $test->expects(self::once())->method('getId')->willReturn($id);
44  $instance = new ilQTIParser('dummy xml file');
45  $instance->setTestObject($test);
46  $this->assertEquals($test, $instance->tst_object);
47  $this->assertEquals($id, $instance->tst_id);
48  }
49 
50  protected function setup(): void
51  {
52  $GLOBALS['DIC'] = $this->getMockBuilder(Container::class)->disableOriginalConstructor()->getMock();
53  $GLOBALS['DIC']->expects(self::any())->method('isDependencyAvailable')->with('language')->willReturn(false);
54  }
55 
56  protected function tearDown(): void
57  {
58  unset($GLOBALS['DIC']);
59  }
60 }
$GLOBALS["DIC"]
Definition: wac.php:31
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23