Skip to content

Commit 366e308

Browse files
committed
Fix PHP5.3 and some tests
1 parent a49b173 commit 366e308

File tree

4 files changed

+40
-40
lines changed

4 files changed

+40
-40
lines changed

src/MessageBird/Resources/Base.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,14 @@ public function getObject()
7171

7272
/**
7373
* @param $object
74-
* @param array $query
74+
* @param array|null $query
7575
*
7676
* @return $this->Object
7777
* @throws Exceptions\HttpException
7878
* @throws Exceptions\RequestException
7979
* @throws Exceptions\ServerException
8080
*/
81-
public function create($object, $query = [])
81+
public function create($object, $query = null)
8282
{
8383
$body = json_encode($object);
8484
list(, , $body) = $this->HttpClient->performHttpRequest(Common\HttpClient::REQUEST_POST, $this->resourceName, $query, $body);

tests/integration/BaseTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public function testClientConstructor()
1313
$this->assertInstanceOf('MessageBird\Resources\Hlr', $MessageBird->hlr);
1414
$this->assertInstanceOf('MessageBird\Resources\Messages', $MessageBird->messages);
1515
$this->assertInstanceOf('MessageBird\Resources\VoiceMessage', $MessageBird->voicemessages);
16-
$this->assertInstanceOf('MessageBird\Resources\Otp', $MessageBird->otp);
16+
$this->assertInstanceOf('MessageBird\Resources\Verify', $MessageBird->verify);
1717
}
1818

1919
public function testHttpClientMock()

tests/integration/otp/OtpTest.php

Lines changed: 0 additions & 37 deletions
This file was deleted.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
class VerifyTest extends BaseTest
3+
{
4+
public function setUp()
5+
{
6+
parent::setup();
7+
$this->client = new \MessageBird\Client('YOUR_ACCESS_KEY', $this->mockClient);
8+
}
9+
10+
/**
11+
* @expectedException MessageBird\Exceptions\ServerException
12+
*/
13+
public function testGenerateOtp()
14+
{
15+
$Verify = new \MessageBird\Objects\Verify();
16+
$Verify->recipient = 31612345678;
17+
$Verify->reference = "Yoloswag3000";
18+
19+
$this->mockClient->expects($this->once())->method('performHttpRequest')->with("POST", 'verify', null, '{"recipient":31612345678,"reference":"Yoloswag3000"}');
20+
21+
$this->client->verify->create($Verify);
22+
}
23+
24+
/**
25+
* @expectedException MessageBird\Exceptions\ServerException
26+
*/
27+
public function testVerifyOtp()
28+
{
29+
$Verify = new \MessageBird\Objects\Verify();
30+
$Verify->recipient = 31612345678;
31+
$Verify->reference = 'Yoloswag3000';
32+
33+
$this->mockClient->expects($this->once())->method('performHttpRequest')->with("GET", 'verify/onofao3f82f7u2fb2uf', ['token' => '123456']);
34+
35+
$this->client->verify->verify('onofao3f82f7u2fb2uf', 123456);
36+
}
37+
}

0 commit comments

Comments
 (0)