public function testMarshallMaximal() { $identifier = 'Q01'; $title = 'Test Item'; $timeDependent = true; $adaptive = true; $lang = 'en-YO'; // Yoda English ;) $responseDeclarations = new ResponseDeclarationCollection(); $responseDeclarations[] = new ResponseDeclaration('resp1', BaseType::INTEGER, Cardinality::SINGLE); $responseDeclarations[] = new ResponseDeclaration('resp2', BaseType::FLOAT, Cardinality::SINGLE); $outcomeDeclarations = new OutcomeDeclarationCollection(); $outcomeDeclarations[] = new OutcomeDeclaration('out1', BaseType::BOOLEAN, Cardinality::MULTIPLE); $outcomeDeclarations[] = new OutcomeDeclaration('out2', BaseType::IDENTIFIER, Cardinality::SINGLE); $item = new AssessmentItem($identifier, $title, $timeDependent, $lang); $item->setAdaptive($adaptive); $item->setResponseDeclarations($responseDeclarations); $item->setOutcomeDeclarations($outcomeDeclarations); $marshaller = $this->getMarshallerFactory()->createMarshaller($item); $element = $marshaller->marshall($item); $this->assertInstanceOf('\\DOMElement', $element); $this->assertEquals('assessmentItem', $element->nodeName); // adaptive, timeDependent, identifier, lang, title $this->assertEquals($element->attributes->length, 5); $this->assertEquals($identifier, $element->getAttribute('identifier')); $this->assertEquals($title, $element->getAttribute('title')); $this->assertEquals('true', $element->getAttribute('timeDependent')); $this->assertEquals('true', $element->getAttribute('adaptive')); $this->assertEquals($lang, $element->getAttribute('lang')); $responseDeclarationElts = $element->getElementsByTagName('responseDeclaration'); $this->assertEquals(2, $responseDeclarationElts->length); $this->assertEquals('resp1', $responseDeclarationElts->item(0)->getAttribute('identifier')); $this->assertEquals('resp2', $responseDeclarationElts->item(1)->getAttribute('identifier')); $outcomeDeclarationElts = $element->getElementsByTagName('outcomeDeclaration'); $this->assertEquals(2, $outcomeDeclarationElts->length); $this->assertEquals('out1', $outcomeDeclarationElts->item(0)->getAttribute('identifier')); $this->assertEquals('out2', $outcomeDeclarationElts->item(1)->getAttribute('identifier')); }