public function testWritePendingResponses()
 {
     $doc = new XmlCompactDocument();
     $doc->load(self::samplesDir() . 'custom/runtime/itemsubset_simultaneous.xml');
     $seeker = new AssessmentTestSeeker($doc->getDocumentComponent(), array('assessmentItemRef', 'assessmentSection', 'testPart', 'outcomeDeclaration', 'responseDeclaration', 'branchRule', 'preCondition'));
     $stream = new MemoryStream();
     $stream->open();
     $access = new QtiBinaryStreamAccessFsFile($stream);
     $factory = new SessionManager();
     $session = $factory->createAssessmentTestSession($doc->getDocumentComponent());
     $session->beginTestSession();
     $session->beginAttempt();
     $session->endAttempt(new State(array(new ResponseVariable('RESPONSE', Cardinality::SINGLE, BaseType::IDENTIFIER, new Identifier('ChoiceB')))));
     $store = $session->getPendingResponseStore();
     $pendingResponses = $store->getPendingResponses($doc->getDocumentComponent()->getComponentByIdentifier('Q01'));
     $access->writePendingResponses($seeker, $pendingResponses);
     $stream->rewind();
     $pendingResponses = $access->readPendingResponses($seeker);
     $state = $pendingResponses->getState();
     $this->assertEquals('ChoiceB', $state['RESPONSE']->getValue());
     $this->assertEquals('Q01', $pendingResponses->getAssessmentItemRef()->getIdentifier());
     $this->assertEquals(0, $pendingResponses->getOccurence());
     $this->assertInternalType('integer', $pendingResponses->getOccurence());
 }