Skip to content

Commit 8142894

Browse files
committed
Refactor deprecated PHPUnit annotations
1 parent 1522523 commit 8142894

File tree

14 files changed

+69
-197
lines changed

14 files changed

+69
-197
lines changed

tests/integration/BaseTest.php

-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ public function testClientConstructor()
4040
$this->assertInstanceOf('MessageBird\Resources\Chat\Platform', $MessageBird->chatPlatforms);
4141
$this->assertInstanceOf('MessageBird\Resources\Chat\Channel', $MessageBird->chatChannels);
4242
$this->assertInstanceOf('MessageBird\Resources\Chat\Contact', $MessageBird->chatContacts);
43-
$this->assertInstanceOf('MessageBird\Resources\AvailableNumbers', $MessageBird->availableNumbers);
44-
$this->assertInstanceOf('MessageBird\Resources\PurchasedNumbers', $MessageBird->purchasedNumbers);
45-
4643
}
4744

4845
public function testHttpClientMock()

tests/integration/HttpClientTest.php

+4-7
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,10 @@ public function testHttpClientValidTimeoutBoundary()
3333
$this->doAssertionToNotBeConsideredRiskyTest();
3434
}
3535

36-
/**
37-
* @expectedException \InvalidArgumentException
38-
* @expectedExceptionMessageRegExp #^Connection timeout must be an int >= 0, got "stdClass".$#
39-
*/
4036
public function testHttpClientInvalidConnectionTimeout()
4137
{
38+
$this->expectException('InvalidArgumentException');
39+
$this->expectExceptionMessageRegExp('#^Connection timeout must be an int >= 0, got "stdClass".$#');
4240
new HttpClient(Client::ENDPOINT, 10, new \stdClass());
4341
}
4442

@@ -54,12 +52,11 @@ public function testHttpClientValidConnectionTimeoutBoundary()
5452

5553
/**
5654
* Test that requests can only be made when there is an Authentication set
57-
*
58-
* @expectedException \MessageBird\Exceptions\AuthenticateException
59-
* @expectedExceptionMessageRegExp #Can not perform API Request without Authentication#
6055
*/
6156
public function testHttpClientWithoutAuthenticationException()
6257
{
58+
$this->expectException('MessageBird\Exceptions\AuthenticateException');
59+
$this->expectExceptionMessageRegExp('#Can not perform API Request without Authentication#');
6360
$client = new HttpClient(Client::ENDPOINT);
6461
$client->performHttpRequest('foo', 'bar');
6562
}

tests/integration/balance/BalanceTest.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@ protected function setUp(): void
77
$this->client = new \MessageBird\Client('YOUR_ACCESS_KEY', $this->mockClient);
88
}
99

10-
/**
11-
* @expectedException MessageBird\Exceptions\ServerException
12-
*/
1310
public function testReadBalance()
1411
{
12+
$this->expectException('MessageBird\Exceptions\ServerException');
1513
$this->expectException(\MessageBird\Exceptions\ServerException::class);
1614
$this->mockClient->expects($this->once())->method('performHttpRequest')->with("GET", 'balance', null, null);
1715
$this->client->balance->read();

tests/integration/chat/ChatTest.php

+10-30
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,16 @@ public function testCreateChatMessage()
1919
$this->client->chatMessages->create($ChatMessage);
2020
}
2121

22-
/**
23-
* @expectedException MessageBird\Exceptions\ServerException
24-
*/
2522
public function testListChatMessage()
2623
{
24+
$this->expectException('MessageBird\Exceptions\ServerException');
2725
$this->mockClient->expects($this->once())->method('performHttpRequest')->with("GET", 'messages', array ('offset' => 100, 'limit' => 30), null);
2826
$ChatMessageList = $this->client->chatMessages->getList(array ('offset' => 100, 'limit' => 30));
2927
}
3028

31-
/**
32-
* @expectedException MessageBird\Exceptions\ServerException
33-
*/
3429
public function testReadChatMessage()
3530
{
31+
$this->expectException('MessageBird\Exceptions\ServerException');
3632
$this->mockClient->expects($this->once())->method('performHttpRequest')->with("GET", 'messages/id', null, null);
3733
$ChatMessageList = $this->client->chatMessages->read("id");
3834
}
@@ -55,29 +51,23 @@ public function testCreateChatChannel()
5551
$this->client->chatChannels->create($ChatChannel);
5652
}
5753

58-
/**
59-
* @expectedException MessageBird\Exceptions\ServerException
60-
*/
6154
public function testListChatChannels()
6255
{
56+
$this->expectException('MessageBird\Exceptions\ServerException');
6357
$this->mockClient->expects($this->once())->method('performHttpRequest')->with("GET", 'channels', array ('offset' => 100, 'limit' => 30), null);
6458
$ChannelList = $this->client->chatChannels->getList(array ('offset' => 100, 'limit' => 30));
6559
}
6660

67-
/**
68-
* @expectedException MessageBird\Exceptions\ServerException
69-
*/
7061
public function testReadChatChannel()
7162
{
63+
$this->expectException('MessageBird\Exceptions\ServerException');
7264
$this->mockClient->expects($this->once())->method('performHttpRequest')->with("GET", 'channels/id', null, null);
7365
$Channel = $this->client->chatChannels->read("id");
7466
}
7567

76-
/**
77-
* @expectedException MessageBird\Exceptions\ServerException
78-
*/
7968
public function testDeleteChannel()
8069
{
70+
$this->expectException('MessageBird\Exceptions\ServerException');
8171
$this->mockClient->expects($this->once())->method('performHttpRequest')->with("DELETE", 'channels/id', null, null);
8272
$Channel = $this->client->chatChannels->delete("id");
8373
}
@@ -93,47 +83,37 @@ public function testUpdateChatChannel()
9383
$this->client->chatChannels->update($ChatChannel,'234agfgADFH2974gaADFH3hudf9h');
9484
}
9585

96-
/**
97-
* @expectedException MessageBird\Exceptions\ServerException
98-
*/
9986
public function testListChatPlatforms()
10087
{
88+
$this->expectException('MessageBird\Exceptions\ServerException');
10189
$this->mockClient->expects($this->once())->method('performHttpRequest')->with("GET", 'platforms', array ('offset' => 100, 'limit' => 30), null);
10290
$ChannelList = $this->client->chatPlatforms->getList(array ('offset' => 100, 'limit' => 30));
10391
}
10492

105-
/**
106-
* @expectedException MessageBird\Exceptions\ServerException
107-
*/
10893
public function testReadChatPlatform()
10994
{
95+
$this->expectException('MessageBird\Exceptions\ServerException');
11096
$this->mockClient->expects($this->once())->method('performHttpRequest')->with("GET", 'platforms/id', null, null);
11197
$Channel = $this->client->chatPlatforms->read("id");
11298
}
11399

114-
/**
115-
* @expectedException MessageBird\Exceptions\ServerException
116-
*/
117100
public function testListChatContacts()
118101
{
102+
$this->expectException('MessageBird\Exceptions\ServerException');
119103
$this->mockClient->expects($this->once())->method('performHttpRequest')->with("GET", 'contacts', array ('offset' => 100, 'limit' => 30), null);
120104
$ContactList = $this->client->chatContacts->getList(array ('offset' => 100, 'limit' => 30));
121105
}
122106

123-
/**
124-
* @expectedException MessageBird\Exceptions\ServerException
125-
*/
126107
public function testReadChatContact()
127108
{
109+
$this->expectException('MessageBird\Exceptions\ServerException');
128110
$this->mockClient->expects($this->once())->method('performHttpRequest')->with("GET", 'contacts/id', null, null);
129111
$Contact = $this->client->chatContacts->read("id");
130112
}
131113

132-
/**
133-
* @expectedException MessageBird\Exceptions\ServerException
134-
*/
135114
public function testDeleteContact()
136115
{
116+
$this->expectException('MessageBird\Exceptions\ServerException');
137117
$this->mockClient->expects($this->once())->method('performHttpRequest')->with("DELETE", 'contacts/id', null, null);
138118
$contact = $this->client->chatContacts->delete("id");
139119
}

tests/integration/contacts/ContactTest.php

+3-9
Original file line numberDiff line numberDiff line change
@@ -45,29 +45,23 @@ public function testCreateContact()
4545
$this->client->contacts->create($Contact);
4646
}
4747

48-
/**
49-
* @expectedException MessageBird\Exceptions\ServerException
50-
*/
5148
public function testListContacts()
5249
{
50+
$this->expectException('MessageBird\Exceptions\ServerException');
5351
$this->mockClient->expects($this->once())->method('performHttpRequest')->with("GET", 'contacts', array ('offset' => 100, 'limit' => 30), null);
5452
$this->client->contacts->getList(array ('offset' => 100, 'limit' => 30));
5553
}
5654

57-
/**
58-
* @expectedException MessageBird\Exceptions\ServerException
59-
*/
6055
public function testViewContact()
6156
{
57+
$this->expectException('MessageBird\Exceptions\ServerException');
6258
$this->mockClient->expects($this->once())->method('performHttpRequest')->with("GET", 'contacts/contact_id', null, null);
6359
$this->client->contacts->read("contact_id");
6460
}
6561

66-
/**
67-
* @expectedException MessageBird\Exceptions\ServerException
68-
*/
6962
public function testDeleteContact()
7063
{
64+
$this->expectException('MessageBird\Exceptions\ServerException');
7165
$this->mockClient->expects($this->once())->method('performHttpRequest')->with("DELETE", 'contacts/contact_id', null, null);
7266
$this->client->contacts->delete("contact_id");
7367
}

tests/integration/groups/GroupTest.php

+3-9
Original file line numberDiff line numberDiff line change
@@ -27,29 +27,23 @@ public function testCreateGroup()
2727
$this->client->groups->create($Group);
2828
}
2929

30-
/**
31-
* @expectedException MessageBird\Exceptions\ServerException
32-
*/
3330
public function testListGroups()
3431
{
32+
$this->expectException('MessageBird\Exceptions\ServerException');
3533
$this->mockClient->expects($this->once())->method('performHttpRequest')->with("GET", 'groups', array ('offset' => 100, 'limit' => 30), null);
3634
$this->client->groups->getList(array ('offset' => 100, 'limit' => 30));
3735
}
3836

39-
/**
40-
* @expectedException MessageBird\Exceptions\ServerException
41-
*/
4237
public function testViewGroup()
4338
{
39+
$this->expectException('MessageBird\Exceptions\ServerException');
4440
$this->mockClient->expects($this->once())->method('performHttpRequest')->with("GET", 'groups/group_id', null, null);
4541
$this->client->groups->read("group_id");
4642
}
4743

48-
/**
49-
* @expectedException MessageBird\Exceptions\ServerException
50-
*/
5144
public function testDeleteGroup()
5245
{
46+
$this->expectException('MessageBird\Exceptions\ServerException');
5347
$this->mockClient->expects($this->once())->method('performHttpRequest')->with("DELETE", 'groups/group_id', null, null);
5448
$this->client->groups->delete("group_id");
5549
}

tests/integration/hlr/HlrTest.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@ protected function setUp(): void
77
$this->client = new \MessageBird\Client('YOUR_ACCESS_KEY', $this->mockClient);
88
}
99

10-
/**
11-
* @expectedException MessageBird\Exceptions\ServerException
12-
*/
1310
public function testCreateHlr()
1411
{
12+
$this->expectException('MessageBird\Exceptions\ServerException');
1513
$Hlr = new \MessageBird\Objects\Hlr();
1614
$Hlr->msisdn = 'MessageBird';
1715
$Hlr->reference = "yoloswag3000";
@@ -21,11 +19,9 @@ public function testCreateHlr()
2119
}
2220

2321

24-
/**
25-
* @expectedException MessageBird\Exceptions\ServerException
26-
*/
2722
public function testReadHlr()
2823
{
24+
$this->expectException('MessageBird\Exceptions\ServerException');
2925
$this->mockClient->expects($this->once())->method('performHttpRequest')->with("GET", 'hlr/message_id', null, null);
3026
$this->client->hlr->read("message_id");
3127
}

tests/integration/lookup/LookupTest.php

+9-27
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,30 @@ protected function setUp(): void
77
$this->client = new \MessageBird\Client('YOUR_ACCESS_KEY', $this->mockClient);
88
}
99

10-
/**
11-
* @expectedException MessageBird\Exceptions\ServerException
12-
*/
1310
public function testReadLookup()
1411
{
12+
$this->expectException('MessageBird\Exceptions\ServerException');
1513
$this->mockClient->expects($this->once())->method('performHttpRequest')->with("GET", 'lookup/31612345678', null, null);
1614
$this->client->lookup->read(31612345678);
1715
}
1816

19-
/**
20-
* @expectedException InvalidArgumentException
21-
*/
2217
public function testReadLookupWithEmptyNumber()
2318
{
19+
$this->expectException('InvalidArgumentException');
2420
$this->client->lookup->read(null);
2521
}
2622

27-
/**
28-
* @expectedException MessageBird\Exceptions\ServerException
29-
*/
3023
public function testReadLookupWithCountryCode()
3124
{
25+
$this->expectException('MessageBird\Exceptions\ServerException');
3226
$params = array("countryCode" => "NL");
3327
$this->mockClient->expects($this->once())->method('performHttpRequest')->with("GET", 'lookup/612345678', $params, null);
3428
$this->client->lookup->read(612345678, $params["countryCode"]);
3529
}
3630

37-
/**
38-
* @expectedException MessageBird\Exceptions\ServerException
39-
*/
4031
public function testCreateLookupHlr()
4132
{
33+
$this->expectException('MessageBird\Exceptions\ServerException');
4234
$Hlr = new \MessageBird\Objects\Hlr();
4335
$Hlr->msisdn = 31612345678;
4436
$Hlr->reference = 'Yoloswag3007';
@@ -48,21 +40,17 @@ public function testCreateLookupHlr()
4840
$this->client->lookupHlr->create($Hlr);
4941
}
5042

51-
/**
52-
* @expectedException InvalidArgumentException
53-
*/
5443
public function testCreateLookupHlrWithEmptyNumber()
5544
{
45+
$this->expectException('InvalidArgumentException');
5646
$Hlr = new \MessageBird\Objects\Hlr();
5747
$Hlr->msisdn = null;
5848
$this->client->lookupHlr->create($Hlr);
5949
}
6050

61-
/**
62-
* @expectedException MessageBird\Exceptions\ServerException
63-
*/
6451
public function testCreateLookupHlrWithCountryCode()
6552
{
53+
$this->expectException('MessageBird\Exceptions\ServerException');
6654
$Hlr = new \MessageBird\Objects\Hlr();
6755
$Hlr->msisdn = 612345678;
6856
$Hlr->reference = "CoolReference";
@@ -74,28 +62,22 @@ public function testCreateLookupHlrWithCountryCode()
7462
$this->client->lookupHlr->create($Hlr, $params["countryCode"]);
7563
}
7664

77-
/**
78-
* @expectedException MessageBird\Exceptions\ServerException
79-
*/
8065
public function testReadLookupHlr()
8166
{
67+
$this->expectException('MessageBird\Exceptions\ServerException');
8268
$this->mockClient->expects($this->once())->method('performHttpRequest')->with("GET", 'lookup/31612345678/hlr', null, null);
8369
$this->client->lookupHlr->read(31612345678);
8470
}
8571

86-
/**
87-
* @expectedException InvalidArgumentException
88-
*/
8972
public function testReadLookupHlrWithEmptyNumber()
9073
{
74+
$this->expectException('InvalidArgumentException');
9175
$this->client->lookupHlr->read(null);
9276
}
9377

94-
/**
95-
* @expectedException MessageBird\Exceptions\ServerException
96-
*/
9778
public function testReadLookupHlrWithCountryCode()
9879
{
80+
$this->expectException('MessageBird\Exceptions\ServerException');
9981
$params = array("countryCode" => "NL");
10082
$this->mockClient->expects($this->once())->method('performHttpRequest')->with("GET", 'lookup/612345678/hlr', $params, null);
10183
$this->client->lookupHlr->read(612345678, $params["countryCode"]);

0 commit comments

Comments
 (0)