/**
  * Marshall an numberIncorrect QTI element in its NumberIncorrect object equivalent.
  * 
  * @param DOMElement A DOMElement object.
  * @return QtiComponent The corresponding NumberIncorrect object.
  */
 protected function unmarshall(DOMElement $element)
 {
     $baseComponent = parent::unmarshall($element);
     $object = new NumberIncorrect();
     $object->setSectionIdentifier($baseComponent->getSectionIdentifier());
     $object->setIncludeCategories($baseComponent->getIncludeCategories());
     $object->setExcludeCategories($baseComponent->getExcludeCategories());
     return $object;
 }
 public function testMarshall()
 {
     $sectionIdentifier = 'mySection1';
     $includeCategory = 'cat1';
     $excludeCategory = 'cat2 cat3';
     $component = new NumberIncorrect();
     $component->setSectionIdentifier($sectionIdentifier);
     $component->setIncludeCategories(new IdentifierCollection(explode(" ", $includeCategory)));
     $component->setExcludeCategories(new IdentifierCollection(explode(" ", $excludeCategory)));
     $marshaller = $this->getMarshallerFactory('2.1.0')->createMarshaller($component);
     $element = $marshaller->marshall($component);
     $this->assertInstanceOf('\\DOMElement', $element);
     $this->assertEquals('numberIncorrect', $element->nodeName);
     $this->assertEquals($sectionIdentifier, $element->getAttribute('sectionIdentifier'));
     $this->assertEquals($includeCategory, $element->getAttribute('includeCategory'));
     $this->assertEquals($excludeCategory, $element->getAttribute('excludeCategory'));
 }
 protected static function getNumberIncorrect($sectionIdentifier = '', IdentifierCollection $includeCategories = null, IdentifierCollection $excludeCategories = null)
 {
     $numberIncorrect = new NumberIncorrect();
     $numberIncorrect->setSectionIdentifier($sectionIdentifier);
     if (empty($includeCategories) === false) {
         $numberIncorrect->setIncludeCategories($includeCategories);
     }
     if (empty($excludeCategories) === false) {
         $numberIncorrect->setExcludeCategories($excludeCategories);
     }
     return $numberIncorrect;
 }