コード例 #1
0
 /**
  * @depends testVeryBasic
  */
 public function testTemplateConstraintImpossibleWithTemplateVariableOnly()
 {
     $component = $this->createComponentFromXml('
         <templateProcessing>
             <setTemplateValue identifier="TEMPLATE">
                 <baseValue baseType="integer">0</baseValue>
             </setTemplateValue>
             <templateConstraint>
                 <gt>
                     <variable identifier="TEMPLATE"/>
                     <baseValue baseType="integer">0</baseValue>
                 </gt>
             </templateConstraint>
         </templateProcessing>
     ');
     $var = new TemplateVariable('TEMPLATE', Cardinality::SINGLE, BaseType::INTEGER);
     $var->setDefaultValue(new QtiInteger(-1));
     $state = new State(array($var));
     // The <templateConstraint> will never be satisfied.
     // We should then find the default value in TEMPLATE.
     $engine = new TemplateProcessingEngine($component, $state);
     $engine->process();
     $this->assertEquals(-1, $state['TEMPLATE']->getValue());
 }