public function testResponseProcessingExitResponse() { $responseProcessing = $this->createComponentFromXml(' <responseProcessing> <exitResponse/> </responseProcessing> '); $engine = new ResponseProcessingEngine($responseProcessing); try { $engine->process(); // An exception MUST be thrown. $this->assertTrue(true); } catch (ProcessingException $e) { $this->assertInstanceOf('qtism\\runtime\\rules\\RuleProcessingException', $e); $this->assertEquals(RuleProcessingException::EXIT_RESPONSE, $e->getCode()); } }
public function testResponseProcessingExitResponse() { $responseProcessing = $this->createComponentFromXml(' <responseProcessing> <setOutcomeValue identifier="OUTCOME"> <baseValue baseType="integer">1</baseValue> </setOutcomeValue> <exitResponse/> <!-- Should never be executed! --> <setOutcomeValue identifier="OUTCOME"> <baseValue baseType="integer">2</baseValue> </setOutcomeValue> </responseProcessing> '); $state = new State(); $state->setVariable(new OutcomeVariable('OUTCOME', Cardinality::SINGLE, BaseType::INTEGER)); $engine = new ResponseProcessingEngine($responseProcessing); $engine->setContext($state); $engine->process(); $this->assertEquals(1, $state['OUTCOME']->getValue()); }