PHP code example of emmo00 / mock-paystack-laravel
1. Go to this page and download the library: Download emmo00/mock-paystack-laravel library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
emmo00 / mock-paystack-laravel example snippets
use Emmo00\MockPaystack\MockPaystack;
class TransactionControllerTest extends TestCase
{
use MockPaystack;
}
use Emmo00\MockPaystack\MockPaystack;
class ExampleTest extends TestCase
{
use MockPaystack;
public function testInitializePayment()
{
$this->fakeInitializePayment(); // this catches any request made to the paystack api and returns a mock response
// make request to endpoint that calls paystack
$response = $this->get(route('subscriptions.pay'));
// Assert
$response->assertStatus(200);
$response->assertJsonStructure([
'message',
'data' => [
'authorization_url',
],
]);
}
}