ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
assAnswerMatchingPairTest.php
Go to the documentation of this file.
1 <?php
2 
27 {
28  protected $backupGlobals = false;
29 
30  protected function setUp(): void
31  {
32  chdir(__DIR__ . '/../../../../');
33  }
34 
35  public function testAnswerMatchingPairInstantiation(): void
36  {
37  $term = new assAnswerMatchingTerm('test');
38  $definition = new assAnswerMatchingDefinition('testing');
39  $instance = new assAnswerMatchingPair($term, $definition, 0.0);
40  $this->assertInstanceOf(assAnswerMatchingPair::class, $instance);
41  }
42 
43  public function testAnswerMatchingPairMutation(): void
44  {
45  $term = new assAnswerMatchingTerm('Term');
46  $definition = new assAnswerMatchingDefinition('Definition');
47  $instance = new assAnswerMatchingPair($term, $definition, 2.1);
48 
49  $this->assertEquals('Term', $instance->getTerm()->getText());
50  $this->assertEquals('Definition', $instance->getDefinition()->getText());
51  $this->assertEquals(2.1, $instance->getPoints());
52 
53  $term = new assAnswerMatchingTerm('another Term');
54  $definition = new assAnswerMatchingDefinition('another Definition');
55  $instance = $instance
56  ->withTerm($term)
57  ->withDefinition($definition)
58  ->withPoints(3.4);
59 
60  $this->assertEquals('another Term', $instance->getTerm()->getText());
61  $this->assertEquals('another Definition', $instance->getDefinition()->getText());
62  $this->assertEquals(3.4, $instance->getPoints());
63  }
64 }
Class for matching question terms.
Class for matching question pairs.
Class assBaseTestCase.
Class for matching question definitions.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...