@@ -71,4 +71,63 @@ public function testDeleteContact()
71
71
$ this ->mockClient ->expects ($ this ->once ())->method ('performHttpRequest ' )->with ("DELETE " , 'contacts/contact_id ' , null , null );
72
72
$ this ->client ->contacts ->delete ("contact_id " );
73
73
}
74
+
75
+ public function testContactGetGroups ()
76
+ {
77
+ $ this ->mockClient ->method ('performHttpRequest ' )
78
+ ->with (
79
+ $ this ->equalTo (MessageBird \Common \HttpClient::REQUEST_GET ), $ this ->equalTo ('contacts/contact_id/groups ' ), $ this ->anything (), $ this ->anything ()
80
+ )
81
+ ->willReturn (array (
82
+ 200 ,
83
+ '' ,
84
+ '{"offset":0,"limit":20,"count":1,"totalCount":1,"links":{"first":"","previous":null,"next":null,"last":""},"items":[{"id":"contact_id","href":"","name":"GroupName","contacts":{"totalCount":1,"href":""},"createdDatetime":"","updatedDatetime":""}]} '
85
+ ));
86
+
87
+ $ ResultingGroupList = $ this ->client ->contacts ->getGroups ("contact_id " );
88
+
89
+ $ GroupList = new \MessageBird \Objects \BaseList ();
90
+ $ GroupList ->offset = 0 ;
91
+ $ GroupList ->count = 1 ;
92
+ $ GroupList ->totalCount = 1 ;
93
+ $ GroupList ->links = (object ) array (
94
+ 'first ' => '' ,
95
+ 'previous ' => null ,
96
+ 'next ' => null ,
97
+ 'last ' => ''
98
+ );
99
+ $ GroupList ->items = array (
100
+ (object ) array (
101
+ 'id ' => 'contact_id ' ,
102
+ 'href ' => '' ,
103
+ 'name ' => 'GroupName ' ,
104
+ 'contacts ' => (object ) array (
105
+ 'totalCount ' => 1 ,
106
+ 'href ' => ''
107
+ ),
108
+ 'createdDatetime ' => '' ,
109
+ 'updatedDatetime ' => ''
110
+ )
111
+ );
112
+
113
+ $ this ->assertEquals ($ GroupList , $ ResultingGroupList );
114
+ }
115
+
116
+ public function testContactGetMessages ()
117
+ {
118
+ $ this ->mockClient ->method ('performHttpRequest ' )
119
+ ->with (
120
+ $ this ->equalTo (MessageBird \Common \HttpClient::REQUEST_GET ), $ this ->equalTo ('contacts/contact_id/messages ' ), $ this ->anything (), $ this ->anything ()
121
+ )
122
+ ->willReturn (array (
123
+ 200 ,
124
+ '' ,
125
+ '{"offset":0,"limit":20,"count":1,"totalCount":1,"links":{"first":"","previous":null,"next":null,"last":""},"items":[{"id":"contact_id","href":"","direction":"mt","type":"sms","originator":"MsgBird","body":"MessageBody","reference":null,"validity":null,"gateway":0,"typeDetails":{},"datacoding":"plain","mclass":1,"scheduledDatetime":null,"createdDatetime":"","recipients":{"totalCount":1,"totalSentCount":1,"totalDeliveredCount":1,"totalDeliveryFailedCount":0,"items":[{"recipient":12345678912,"status":"delivered","statusDatetime":""}]}}]} '
126
+ ));
127
+
128
+ $ Messages = $ this ->client ->contacts ->getMessages ("contact_id " );
129
+ foreach ($ Messages ->items as $ Message ) {
130
+ $ this ->assertInstanceOf ('\MessageBird\Objects\Message ' , $ Message );
131
+ }
132
+ }
74
133
}
0 commit comments