Beispiel #1
0
 /**
  * @dataProvider getIdentifierAtWithInvalidIndexesProvider
  */
 public function testGetIdentifierAtWithInvalidIndexes($index)
 {
     $identifiers1 = new IdentifierCollection(array('id1', 'id2', 'id3'));
     $identifiers2 = new IdentifierCollection(array('id4', 'id5', 'id6'));
     $group1 = new ShufflingGroup($identifiers1);
     $group2 = new ShufflingGroup($identifiers2);
     $shuffling = new Shuffling('RESPONSE', new ShufflingGroupCollection(array($group1, $group2)));
     $this->setExpectedException('\\OutOfBoundsException');
     $identifier = $shuffling->getIdentifierAt($index);
 }
 /**
  * Write a Shuffling object in the current binary stream.
  * 
  * @param \qtism\data\state\Shuffling $shufflingState
  * @throws QtiBinaryStreamAccessException
  */
 public function writeShufflingState(Shuffling $shufflingState)
 {
     try {
         $this->writeIdentifier($shufflingState->getResponseIdentifier());
         $shufflingGroups = $shufflingState->getShufflingGroups();
         $this->writeTinyInt(count($shufflingGroups));
         foreach ($shufflingGroups as $shufflingGroup) {
             $this->writeShufflingGroup($shufflingGroup);
         }
     } catch (BinaryStreamAccessException $e) {
         $msg = "An error occured while writing a shufflingState.";
         throw new QtiBinaryStreamAccessException($msg, $this, QtiBinaryStreamAccessException::SHUFFLING_STATE, $e);
     }
 }