public function testCreateFromDataModelNoFieldIdentifier()
 {
     $valueCollection = new ValueCollection();
     $value = new Value(15, BaseType::INTEGER);
     $value->setPartOfRecord(true);
     $valueCollection[] = $value;
     $this->setExpectedException('\\InvalidArgumentException');
     $record = RecordContainer::createFromDataModel($valueCollection);
 }
Exemplo n.º 2
0
 public function testUnmarshallState()
 {
     $json = '
         {
             "RESPONSE1": { "base" : { "identifier" : "ChoiceA" } },
             "RESPONSE2": { "list" : { "identifier" : ["_id1", "id2", "ID3"] } },
             "RESPONSE3": { "record" : [ { "name" : "rock", "base": { "identifier" : "Paper" } } ] },
             "RESPONSE4": { "base" : null }
         }
     ';
     $unmarshaller = self::createUnmarshaller();
     $state = $unmarshaller->unmarshall($json);
     $this->assertEquals(4, count($state));
     $this->assertEquals(array('RESPONSE1', 'RESPONSE2', 'RESPONSE3', 'RESPONSE4'), array_keys($state));
     $response1 = new Identifier('ChoiceA');
     $response2 = new MultipleContainer(BaseType::IDENTIFIER, array(new Identifier('_id1'), new Identifier('id2'), new Identifier('ID3')));
     $response3 = new RecordContainer(array('rock' => new Identifier('Paper')));
     $response4 = null;
     $this->assertTrue($response1->equals($state['RESPONSE1']));
     $this->assertTrue($response2->equals($state['RESPONSE2']));
     $this->assertTrue($response3->equals($state['RESPONSE3']));
     $this->assertSame($response4, $state['RESPONSE4']);
 }