Skip to content

Commit

Permalink
test(jusibe): Refactor some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
unicodeveloper committed Apr 17, 2016
1 parent 8b19f3a commit 0257d41
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/Jusibe.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 136,7 @@ public function checkAvailableCredits()
public function checkDeliveryStatus($messageID = null)
{
if (is_null($messageID)) {
throw IsEmpty::create("Message ID can not be empty.");
throw IsNull::create("Message ID can not be empty.");
}

$this->performGetRequest("/smsapi/delivery_status?message_id={$messageID}");
Expand Down
21 changes: 10 additions & 11 deletions tests/JusibeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 15,9 @@
use PHPUnit_Framework_TestCase;
use Unicodeveloper\Jusibe\Helper;
use Unicodeveloper\Jusibe\Jusibe;
use Unicodeveloper\Jusibe\Exceptions\IsNull;
use Unicodeveloper\Jusibe\Exceptions\IsEmpty;


class JusibeTest extends PHPUnit_Framework_TestCase
{
Expand Down Expand Up @@ -66,18 69,14 @@ public function testAvailableCreditsCanBeReturned()
}

/**
* @throws IsEmpty Exception
* @setExpectedException \Unicodeveloper\Jusibe\Exceptions\IsEmpty
* @throws IsEmpty
* test that SendSMSWithoutPayload throws an exception
*/
public function testSendSMSWithoutPayload()
{
// return a reference to the stubbed Jusibe object
$this->jusibe->method('sendSMS')
->will($this->returnSelf());

// now stub out the getResponse method
$this->jusibe->method('getResponse')
->willReturn($this->sendSMSResponse());
->will($this->throwException(new IsEmpty));
}

/**
Expand Down Expand Up @@ -126,14 125,14 @@ public function testDeliveryStatusCanBeReturned()
}

/**
* @setExpectedException \Unicodeveloper\Jusibe\Exceptions\IsEmpty
*/
* @throws IsNull
* test that CheckDeliveryStatusWithoutMessageID throws an exception
*/
public function testCheckDeliveryStatusWithoutMessageID()
{
// return a reference to the stubbed Jusibe object
$this->jusibe->method('checkDeliveryStatus')
->with(null)
->will($this->returnSelf());
->will($this->throwException(new IsNull));
}

/**
Expand Down

0 comments on commit 0257d41

Please sign in to comment.