subject = new LtiOutcomeXmlFactory(); } /** * @dataProvider provideOutcomeXML */ public function testBuild(string $expected, array $data): void { $this->assertEquals( $expected, $this->subject->buildReplaceResultRequest( $data['sourcedId'], $data['grade'], $data['messageIdentifier'], $data['language'] ) ); } /** * @dataProvider provideOutcomeXML */ public function testBuildWithDefault(string $expected, array $data): void { $this->assertEquals( $expected, $this->subject->buildReplaceResultRequest( $data['sourcedId'], $data['grade'], $data['messageIdentifier'] ) ); } public function provideOutcomeXML(): array { $sourcedId = 'sourcedId'; $messageIdentifier = uniqid('', true); $operation = 'replaceResultRequest'; $grade = 0.1; $language = 'en-us'; $expected = ' V1.0 ' . $messageIdentifier . ' <' . $operation . '> ' . $sourcedId . ' ' . $language . ' ' . $grade . ' '; return [ [ 'expected' => $expected, [ 'sourcedId' => $sourcedId, 'grade' => $grade, 'messageIdentifier' => $messageIdentifier, 'language' => $language ] ], ]; } }