public function testPropertyVisiblity()
 {
     $test = new PropertyVisibilityTestClass();
     $serializer = new Serializer();
     $data = $serializer->toArray($test);
     $this->assertEquals($data['publicFoo'], 1);
     $this->assertEquals($data['protectedFoo'], 2);
     $this->assertEquals($data['privateFoo'], 3);
     $this->assertEquals($data['publicBar'], 1);
     $this->assertEquals($data['protectedBar'], 2);
     $this->assertEquals($data['privateBar'], 3);
 }
Esempio n. 2
0
 public function testSerialize()
 {
     $test = new FooClass();
     $serializer = new Serializer();
     $data = $serializer->toArray($test);
     $this->assertEquals($data['stringProp'], "abc");
     $this->assertEquals($data['intProp'], 123);
     $this->assertEquals($data['integerProp'], 456);
     $this->assertEquals($data['stringValue'], 'xyz');
     $this->assertEquals($data['intValue'], 123);
     $this->assertEquals($data['integerValue'], 456);
     //$json = $serializer->toJson( $test );
 }