Example #1
0
 public function testWriteTypedObjectVector()
 {
     $data = [new ContactElt(["id" => 10, "firstname" => "First name 1", "lastname" => "Last name 1", "email" => "*****@*****.**", "mobile" => "0912345678"]), new ContactElt(["id" => 15, "firstname" => "First name 2", "lastname" => "Last name 2", "email" => "*****@*****.**", "mobile" => "0912345679"]), new ContactElt(["id" => 17, "firstname" => "First name 3", "lastname" => "Last name 3", "email" => "*****@*****.**", "mobile" => "0912345680"])];
     $container = new Container();
     $container->data = $data;
     $outputStream = new OutputStream();
     $serializer = new Amf3Serializer($outputStream);
     $serializer->writeTypeMarker($container);
     // Load the expected binary.
     $mockFile = file_get_contents(dirname(__FILE__) . '/Parse/mock/amf3TypedVector.bin');
     // Check that the serialized binary data matches the expected serialized value
     $this->assertEquals($mockFile, $outputStream->getStream());
 }
Example #2
0
 /**
  * Encountered and AMF3 Type Marker use AMF3 serializer. Once AMF3 is
  * encountered it will not return to AMf0.
  *
  * @param  string $data
  * @return Amf0Serializer
  */
 public function writeAmf3TypeMarker(&$data)
 {
     $serializer = new Amf3Serializer($this->_stream);
     $serializer->writeTypeMarker($data);
     return $this;
 }