1
1
<?php
2
2
class ChatTest extends BaseTest
3
3
{
4
- public function setUp ()
4
+ protected function setUp (): void
5
5
{
6
6
parent ::setUp ();
7
7
$ this ->client = new \MessageBird \Client ('YOUR_ACCESS_KEY ' , $ this ->mockClient );
@@ -19,20 +19,16 @@ public function testCreateChatMessage()
19
19
$ this ->client ->chatMessages ->create ($ ChatMessage );
20
20
}
21
21
22
- /**
23
- * @expectedException MessageBird\Exceptions\ServerException
24
- */
25
22
public function testListChatMessage ()
26
23
{
24
+ $ this ->expectException (\MessageBird \Exceptions \ServerException::class);
27
25
$ this ->mockClient ->expects ($ this ->once ())->method ('performHttpRequest ' )->with ("GET " , 'messages ' , array ('offset ' => 100 , 'limit ' => 30 ), null );
28
26
$ ChatMessageList = $ this ->client ->chatMessages ->getList (array ('offset ' => 100 , 'limit ' => 30 ));
29
27
}
30
28
31
- /**
32
- * @expectedException MessageBird\Exceptions\ServerException
33
- */
34
29
public function testReadChatMessage ()
35
30
{
31
+ $ this ->expectException (\MessageBird \Exceptions \ServerException::class);
36
32
$ this ->mockClient ->expects ($ this ->once ())->method ('performHttpRequest ' )->with ("GET " , 'messages/id ' , null , null );
37
33
$ ChatMessageList = $ this ->client ->chatMessages ->read ("id " );
38
34
}
@@ -55,29 +51,23 @@ public function testCreateChatChannel()
55
51
$ this ->client ->chatChannels ->create ($ ChatChannel );
56
52
}
57
53
58
- /**
59
- * @expectedException MessageBird\Exceptions\ServerException
60
- */
61
54
public function testListChatChannels ()
62
55
{
56
+ $ this ->expectException (\MessageBird \Exceptions \ServerException::class);
63
57
$ this ->mockClient ->expects ($ this ->once ())->method ('performHttpRequest ' )->with ("GET " , 'channels ' , array ('offset ' => 100 , 'limit ' => 30 ), null );
64
58
$ ChannelList = $ this ->client ->chatChannels ->getList (array ('offset ' => 100 , 'limit ' => 30 ));
65
59
}
66
60
67
- /**
68
- * @expectedException MessageBird\Exceptions\ServerException
69
- */
70
61
public function testReadChatChannel ()
71
62
{
63
+ $ this ->expectException (\MessageBird \Exceptions \ServerException::class);
72
64
$ this ->mockClient ->expects ($ this ->once ())->method ('performHttpRequest ' )->with ("GET " , 'channels/id ' , null , null );
73
65
$ Channel = $ this ->client ->chatChannels ->read ("id " );
74
66
}
75
67
76
- /**
77
- * @expectedException MessageBird\Exceptions\ServerException
78
- */
79
68
public function testDeleteChannel ()
80
69
{
70
+ $ this ->expectException (\MessageBird \Exceptions \ServerException::class);
81
71
$ this ->mockClient ->expects ($ this ->once ())->method ('performHttpRequest ' )->with ("DELETE " , 'channels/id ' , null , null );
82
72
$ Channel = $ this ->client ->chatChannels ->delete ("id " );
83
73
}
@@ -93,47 +83,37 @@ public function testUpdateChatChannel()
93
83
$ this ->client ->chatChannels ->update ($ ChatChannel ,'234agfgADFH2974gaADFH3hudf9h ' );
94
84
}
95
85
96
- /**
97
- * @expectedException MessageBird\Exceptions\ServerException
98
- */
99
86
public function testListChatPlatforms ()
100
87
{
88
+ $ this ->expectException (\MessageBird \Exceptions \ServerException::class);
101
89
$ this ->mockClient ->expects ($ this ->once ())->method ('performHttpRequest ' )->with ("GET " , 'platforms ' , array ('offset ' => 100 , 'limit ' => 30 ), null );
102
90
$ ChannelList = $ this ->client ->chatPlatforms ->getList (array ('offset ' => 100 , 'limit ' => 30 ));
103
91
}
104
92
105
- /**
106
- * @expectedException MessageBird\Exceptions\ServerException
107
- */
108
93
public function testReadChatPlatform ()
109
94
{
95
+ $ this ->expectException (\MessageBird \Exceptions \ServerException::class);
110
96
$ this ->mockClient ->expects ($ this ->once ())->method ('performHttpRequest ' )->with ("GET " , 'platforms/id ' , null , null );
111
97
$ Channel = $ this ->client ->chatPlatforms ->read ("id " );
112
98
}
113
99
114
- /**
115
- * @expectedException MessageBird\Exceptions\ServerException
116
- */
117
100
public function testListChatContacts ()
118
101
{
102
+ $ this ->expectException (\MessageBird \Exceptions \ServerException::class);
119
103
$ this ->mockClient ->expects ($ this ->once ())->method ('performHttpRequest ' )->with ("GET " , 'contacts ' , array ('offset ' => 100 , 'limit ' => 30 ), null );
120
104
$ ContactList = $ this ->client ->chatContacts ->getList (array ('offset ' => 100 , 'limit ' => 30 ));
121
105
}
122
106
123
- /**
124
- * @expectedException MessageBird\Exceptions\ServerException
125
- */
126
107
public function testReadChatContact ()
127
108
{
109
+ $ this ->expectException (\MessageBird \Exceptions \ServerException::class);
128
110
$ this ->mockClient ->expects ($ this ->once ())->method ('performHttpRequest ' )->with ("GET " , 'contacts/id ' , null , null );
129
111
$ Contact = $ this ->client ->chatContacts ->read ("id " );
130
112
}
131
113
132
- /**
133
- * @expectedException MessageBird\Exceptions\ServerException
134
- */
135
114
public function testDeleteContact ()
136
115
{
116
+ $ this ->expectException (\MessageBird \Exceptions \ServerException::class);
137
117
$ this ->mockClient ->expects ($ this ->once ())->method ('performHttpRequest ' )->with ("DELETE " , 'contacts/id ' , null , null );
138
118
$ contact = $ this ->client ->chatContacts ->delete ("id " );
139
119
}
0 commit comments