Skip to content

Commit

Permalink
Fixed incorrect types
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelsharman committed Apr 20, 2021
1 parent 041333b commit 3bd08cb
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function testMapResponseBasic()
$this->assertCount(1, $questions);
$this->assertContains('<p>Test intro</p>', $questions[0]->get_data()->get_stimulus());
$this->assertEquals('graphicGapfill_RESPONSE', $questions[0]->get_reference());
$this->assertEquals('imageclozeassociation', $questions[0]->get_type());
$this->assertEquals('imageclozeassociationV2', $questions[0]->get_type());
/** @var imageclozeassociation $question */
$question = $questions[0]->get_data();
$this->assertEquals([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function testWithNoValidation()
$question = $mapper->getQuestionType();

$this->assertNotNull($question);
$this->assertEquals('longtext', $question->get_type());
$this->assertEquals('longtextV2', $question->get_type());
$this->assertEquals('Please describe yourself in few words', $question->get_stimulus());
$this->assertNull($question->get_validation());
}
Expand Down Expand Up @@ -69,4 +69,4 @@ private function buildExtendedTextInteraction($identifier)
$interaction->setPrompt($prompt);
return $interaction;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public function testWithMapResponseValidationMixedResponses()
$q = $mapper->getQuestionType();
$this->assertEquals('clozeassociation', $q->get_type());
$this->assertEquals('<p>{{response}}{{response}}</p>', $q->get_template());
$this->assertEquals(['Gap A', 'Gap B', '<img src="http://img_C"/>', '<img src="http://img_D"/>'], $q->get_possible_responses());
$this->assertEquals(['Gap A', 'Gap B', '<img src="http://img_C" width="-1" height="-1"/>', '<img src="http://img_D" width="-1" height="-1"/>'], $q->get_possible_responses());
$this->assertTrue($q->get_duplicate_responses());

$validation = $q->get_validation();
Expand All @@ -248,20 +248,20 @@ public function testWithMapResponseValidationMixedResponses()
$validResponse
);
$this->assertEquals(9, $validResponse->get_score());
$this->assertEquals(['<img src="http://img_D"/>', 'Gap B'], $validResponse->get_value());
$this->assertEquals(['<img src="http://img_D" width="-1" height="-1"/>', 'Gap B'], $validResponse->get_value());

$altResponses = $validation->get_alt_responses();
$this->assertCount(5, $altResponses);
$this->assertEquals(8, $altResponses[0]->get_score());
$this->assertEquals(['<img src="http://img_D"/>', '<img src="http://img_C"/>'], $altResponses[0]->get_value());
$this->assertEquals(['<img src="http://img_D" width="-1" height="-1"/>', '<img src="http://img_C" width="-1" height="-1"/>'], $altResponses[0]->get_value());
$this->assertEquals(6, $altResponses[1]->get_score());
$this->assertEquals(['Gap B', 'Gap B'], $altResponses[1]->get_value());
$this->assertEquals(5, $altResponses[2]->get_score());
$this->assertEquals(['Gap A', 'Gap B'], $altResponses[2]->get_value());
$this->assertEquals(5, $altResponses[3]->get_score());
$this->assertEquals(['Gap B', '<img src="http://img_C"/>'], $altResponses[3]->get_value());
$this->assertEquals(['Gap B', '<img src="http://img_C" width="-1" height="-1"/>'], $altResponses[3]->get_value());
$this->assertEquals(4, $altResponses[4]->get_score());
$this->assertEquals(['Gap A', '<img src="http://img_C"/>'], $altResponses[4]->get_value());
$this->assertEquals(['Gap A', '<img src="http://img_C" width="-1" height="-1"/>'], $altResponses[4]->get_value());
}

public function testWithMatchCorrectResponseSwappedValuePair()
Expand Down Expand Up @@ -366,19 +366,19 @@ public function testMapResponseWithSwappedValuePair()
$validResponse
);
$this->assertEquals(9, $validResponse->get_score());
$this->assertEquals(['<img src="http://img_D"/>', 'Gap B'], $validResponse->get_value());
$this->assertEquals(['<img src="http://img_D" width="-1" height="-1"/>', 'Gap B'], $validResponse->get_value());

$altResponses = $validation->get_alt_responses();
$this->assertCount(5, $altResponses);
$this->assertEquals(8, $altResponses[0]->get_score());
$this->assertEquals(['<img src="http://img_D"/>', '<img src="http://img_C"/>'], $altResponses[0]->get_value());
$this->assertEquals(['<img src="http://img_D" width="-1" height="-1"/>', '<img src="http://img_C" width="-1" height="-1"/>'], $altResponses[0]->get_value());
$this->assertEquals(6, $altResponses[1]->get_score());
$this->assertEquals(['Gap B', 'Gap B'], $altResponses[1]->get_value());
$this->assertEquals(5, $altResponses[2]->get_score());
$this->assertEquals(['Gap A', 'Gap B'], $altResponses[2]->get_value());
$this->assertEquals(5, $altResponses[3]->get_score());
$this->assertEquals(['Gap B', '<img src="http://img_C"/>'], $altResponses[3]->get_value());
$this->assertEquals(['Gap B', '<img src="http://img_C" width="-1" height="-1"/>'], $altResponses[3]->get_value());
$this->assertEquals(4, $altResponses[4]->get_score());
$this->assertEquals(['Gap A', '<img src="http://img_C"/>'], $altResponses[4]->get_value());
$this->assertEquals(['Gap A', '<img src="http://img_C" width="-1" height="-1"/>'], $altResponses[4]->get_value());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public function testWithMapResponseValidationMissingAssociableIdentifier()
$mapper = new GraphicGapMatchInteractionMapper($testInteraction, $responseDeclaration, $responseProcessingTemplate);
/** @var imageclozeassociation $q */
$q = $mapper->getQuestionType();
$this->assertEquals('imageclozeassociation', $q->get_type());
$this->assertEquals(['<img src="img_A.png"/>', '<img src="img_B.png"/>', '<img src="img_C.png"/>'], $q->get_possible_responses());
$this->assertEquals('imageclozeassociationV2', $q->get_type());
$this->assertEquals(['<img src="img_A.png" width="-1" height="-1"/>', '<img src="img_B.png" width="-1" height="-1"/>', '<img src="img_C.png" width="-1" height="-1"/>'], $q->get_possible_responses());
$this->assertFalse($q->get_duplicate_responses());
$this->assertNull($q->get_validation());

Expand Down Expand Up @@ -112,8 +112,8 @@ public function testMapResponseValidation()
$mapper = new GraphicGapMatchInteractionMapper($testInteraction, $responseDeclaration, $responseProcessingTemplate);
/** @var imageclozeassociation $q */
$q = $mapper->getQuestionType();
$this->assertEquals('imageclozeassociation', $q->get_type());
$this->assertEquals(['<img src="img_A.png"/>', '<img src="img_B.png"/>', '<img src="img_C.png"/>'], $q->get_possible_responses());
$this->assertEquals('imageclozeassociationV2', $q->get_type());
$this->assertEquals(['<img src="img_A.png" width="-1" height="-1"/>', '<img src="img_B.png" width="-1" height="-1"/>', '<img src="img_C.png" width="-1" height="-1"/>'], $q->get_possible_responses());
$this->assertFalse($q->get_duplicate_responses());

$this->assertEquals([
Expand Down Expand Up @@ -179,8 +179,8 @@ public function testMatchCorrectValidation()
/** @var imageclozeassociation $q */
$q = $mapper->getQuestionType();

$this->assertEquals('imageclozeassociation', $q->get_type());
$this->assertEquals(['<img src="img_A.png"/>', '<img src="img_B.png"/>'], $q->get_possible_responses());
$this->assertEquals('imageclozeassociationV2', $q->get_type());
$this->assertEquals(['<img src="img_A.png" width="-1" height="-1"/>', '<img src="img_B.png" width="-1" height="-1"/>'], $q->get_possible_responses());
$this->assertTrue($q->get_duplicate_responses());

$this->assertEquals([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace LearnosityQti\Tests\Unit\Processors\QtiV2\Out\QuestionTypes;

use LearnosityQti\Entities\QuestionTypes\longtext;
use LearnosityQti\Entities\QuestionTypes\longtextV2;
use LearnosityQti\Processors\QtiV2\Out\QuestionTypes\LongtextMapper;
use LearnosityQti\Utils\QtiMarshallerUtil;
use qtism\data\content\interactions\ExtendedTextInteraction;
Expand All @@ -16,7 +16,7 @@ public function testMappingSimpleQuestionWithNoValidation()
$stimulus = '<strong>stimulushere</strong>';
$questionReference = 'questionReferenceOne';

$question = new longtext('longtext');
$question = new longtext('longtextV2');
$question->set_placeholder($placeholder);
$question->set_stimulus($stimulus);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function testMappingSimpleQuestionWithNoValidation()
$questionReference
);

// No validation shall be mapped for longtext
// No validation shall be mapped for plaintext
$this->assertNull($responseDeclaration);
$this->assertNull($responseProcessing);

Expand Down

0 comments on commit 3bd08cb

Please sign in to comment.