Skip to content

Commit

Permalink
Merge pull request #19 from Mane-Olawale/fix-dnd-test
Browse files Browse the repository at this point in the history
fix: add dnd test tag
  • Loading branch information
Mane-Olawale authored Aug 21, 2022
2 parents a2e1f97 + c86db0c commit a550747
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Testing/TermiiFake.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ protected function aliasMap()
'inapp' => 'api/sms/otp/generate',
'balance' => 'api/get-balance',
'search' => 'api/insight/number/query',
'inbox' => 'api/sms/inbox'
'inbox' => 'api/sms/inbox',
'dnd' => 'api/check/dnd'
];
}
}
28 changes: 28 additions & 0 deletions tests/TestingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,34 @@ public function testMockingAssertSuccessful()
$termii->assertSentSuccessfulTimes('send', 2);
}

public function testMockingDndSuccessful()
{
$termii = new Termii(new Client(
'key',
[
'sender_id' => 'Olawale',
'channel' => 'generic'
]
));

$termii->fake()->mock('dnd', Sequence::create(new Response(
404,
['Content-Type' => 'application/json'],
json_encode([
'number' => '2347041945964',
'message' => 'Phone either not on DND or is not in our Database',
'status' => 'DND not active on phone number',
'dnd_active' => false,
'network' => '62130',
'network_code' => 'MTN Nigeria'
])
)));

$termii->insights()->search('2347041945964');

$termii->assertSentFailed('dnd');
}

public function testMockingAssertFailed()
{
$termii = new Termii(new Client(
Expand Down

0 comments on commit a550747

Please sign in to comment.