@@ -18,14 +18,14 @@ public function testCouldSetGetNativeMessage()
18
18
19
19
public function testColdBeSerializedToJson ()
20
20
{
21
- $ message = new GpsMessage ('theBody ' , ['thePropFoo ' => 'thePropFooVal ' ], ['theHeaderFoo ' => 'theHeaderFooVal ' ]);
21
+ $ message = new GpsMessage ('theBody ' , ['thePropFoo ' => 'thePropFooVal ' ], ['theHeaderFoo ' => 'theHeaderFooVal ' ], [ ' theAttributeFoo ' => ' theAttributeFooVal ' ] );
22
22
23
- $ this ->assertEquals ('{"body":"theBody","properties":{"thePropFoo":"thePropFooVal"},"headers":{"theHeaderFoo":"theHeaderFooVal"}} ' , json_encode ($ message ));
23
+ $ this ->assertEquals ('{"body":"theBody","properties":{"thePropFoo":"thePropFooVal"},"headers":{"theHeaderFoo":"theHeaderFooVal"},"attributes":{"theAttributeFoo":"theAttributeFooVal"} } ' , json_encode ($ message ));
24
24
}
25
25
26
26
public function testCouldBeUnserializedFromJson ()
27
27
{
28
- $ message = new GpsMessage ('theBody ' , ['thePropFoo ' => 'thePropFooVal ' ], ['theHeaderFoo ' => 'theHeaderFooVal ' ]);
28
+ $ message = new GpsMessage ('theBody ' , ['thePropFoo ' => 'thePropFooVal ' ], ['theHeaderFoo ' => 'theHeaderFooVal ' ], [ ' theAttributeFoo ' => ' theAttributeFooVal ' ] );
29
29
30
30
$ json = json_encode ($ message );
31
31
@@ -40,7 +40,7 @@ public function testCouldBeUnserializedFromJson()
40
40
41
41
public function testMessageEntityCouldBeUnserializedFromJson ()
42
42
{
43
- $ json = '{"body":"theBody","properties":{"thePropFoo":"thePropFooVal"},"headers":{"theHeaderFoo":"theHeaderFooVal"}} ' ;
43
+ $ json = '{"body":"theBody","properties":{"thePropFoo":"thePropFooVal"},"headers":{"theHeaderFoo":"theHeaderFooVal"},"attributes":{"theAttributeFoo":"theAttributeFooVal"} } ' ;
44
44
45
45
$ unserializedMessage = GpsMessage::jsonUnserialize ($ json );
46
46
@@ -49,6 +49,7 @@ public function testMessageEntityCouldBeUnserializedFromJson()
49
49
$ this ->assertEquals ($ decoded ['body ' ], $ unserializedMessage ->getBody ());
50
50
$ this ->assertEquals ($ decoded ['properties ' ], $ unserializedMessage ->getProperties ());
51
51
$ this ->assertEquals ($ decoded ['headers ' ], $ unserializedMessage ->getHeaders ());
52
+ $ this ->assertEquals ($ decoded ['attributes ' ], $ unserializedMessage ->getAttributes ());
52
53
}
53
54
54
55
public function testMessagePayloadCouldBeUnserializedFromJson ()
@@ -61,6 +62,7 @@ public function testMessagePayloadCouldBeUnserializedFromJson()
61
62
$ this ->assertEquals ($ json , $ unserializedMessage ->getBody ());
62
63
$ this ->assertEquals ([], $ unserializedMessage ->getProperties ());
63
64
$ this ->assertEquals ([], $ unserializedMessage ->getHeaders ());
65
+ $ this ->assertEquals ([], $ unserializedMessage ->getAttributes ());
64
66
}
65
67
66
68
public function testThrowIfMalformedJsonGivenOnUnsterilizedFromJson ()
0 commit comments