Esempio n. 1
0
 public function testFormatRepeatedNested()
 {
     $repeated = new Repeated();
     $nested1 = new Repeated\Nested();
     $nested2 = new Repeated\Nested();
     $nested3 = new Repeated\Nested();
     $nested1->setId(1);
     $nested2->setId(2);
     $nested3->setId(3);
     $repeated->addNested($nested1);
     $repeated->addNested($nested2);
     $repeated->addNested($nested3);
     $expected = $this->getProtoContent('repeated-nested.txt');
     $actual = $this->textFormat->encodeMessage($repeated);
     $this->assertEquals($expected, (string) $actual);
 }
 public function testWriteRepeatedNested()
 {
     $repeated = new Repeated();
     $nested1 = new Repeated\Nested();
     $nested2 = new Repeated\Nested();
     $nested3 = new Repeated\Nested();
     $nested1->setId(1);
     $nested2->setId(2);
     $nested3->setId(3);
     $repeated->addNested($nested1);
     $repeated->addNested($nested2);
     $repeated->addNested($nested3);
     $expected = $this->getProtoContent('repeated-nested.bin');
     $actual = $repeated->toStream();
     $this->assertEquals($expected, (string) $actual);
     $this->assertSerializedMessageSize($expected, $repeated);
 }