From 98f3302421ebcff5c7a52a651f577c49329a9e91 Mon Sep 17 00:00:00 2001 From: gathuku Date: Sun, 10 May 2020 14:33:11 +0300 Subject: [PATCH] Fix mpesaExpress tests --- .phpunit.result.cache | 2 +- tests/Unit/MpesaExpressTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.phpunit.result.cache b/.phpunit.result.cache index 930a705..200bbc8 100644 --- a/.phpunit.result.cache +++ b/.phpunit.result.cache @@ -1 +1 @@ -C:37:"PHPUnit\Runner\DefaultTestResultCache":997:{a:2:{s:7:"defects";a:5:{s:42:"Gathuku\Mpesa\Tests\BaseTest::true_is_true";i:4;s:55:"Gathuku\Mpesa\Tests\Unit\InstallMpesaTest::true_is_true";i:4;s:57:"Gathuku\Mpesa\Tests\Unit\MpesaAuthTokenTest::true_is_true";i:4;s:47:"Gathuku\Mpesa\Tests\Unit\MpesaB2CTest::test_b2c";i:3;s:61:"Gathuku\Mpesa\Tests\Unit\MpesaExpressTest::test_mpesa_express";i:3;}s:5:"times";a:9:{s:42:"Gathuku\Mpesa\Tests\BaseTest::true_is_true";d:0.24;s:55:"Gathuku\Mpesa\Tests\Unit\InstallMpesaTest::true_is_true";d:0.155;s:57:"Gathuku\Mpesa\Tests\Unit\MpesaAuthTokenTest::true_is_true";d:0.152;s:60:"Gathuku\Mpesa\Tests\Unit\MpesaRegisterUrlsTest::true_is_true";d:0.158;s:47:"Gathuku\Mpesa\Tests\Unit\MpesaB2CTest::test_b2c";d:1.624;s:51:"Gathuku\Mpesa\Tests\Unit\MpesaB2CTest::true_is_true";d:0.154;s:61:"Gathuku\Mpesa\Tests\Unit\MpesaExpressTest::test_mpesa_express";d:2.305;s:55:"Gathuku\Mpesa\Tests\Unit\MpesaExpressTest::true_is_true";d:0.159;s:60:"Gathuku\Mpesa\Tests\Unit\MpesaSimeulateC2BTest::true_is_true";d:0.154;}}} \ No newline at end of file +C:37:"PHPUnit\Runner\DefaultTestResultCache":997:{a:2:{s:7:"defects";a:5:{s:42:"Gathuku\Mpesa\Tests\BaseTest::true_is_true";i:4;s:55:"Gathuku\Mpesa\Tests\Unit\InstallMpesaTest::true_is_true";i:4;s:57:"Gathuku\Mpesa\Tests\Unit\MpesaAuthTokenTest::true_is_true";i:4;s:47:"Gathuku\Mpesa\Tests\Unit\MpesaB2CTest::test_b2c";i:3;s:61:"Gathuku\Mpesa\Tests\Unit\MpesaExpressTest::test_mpesa_express";i:3;}s:5:"times";a:9:{s:42:"Gathuku\Mpesa\Tests\BaseTest::true_is_true";d:1.556;s:55:"Gathuku\Mpesa\Tests\Unit\InstallMpesaTest::true_is_true";d:0.14;s:57:"Gathuku\Mpesa\Tests\Unit\MpesaAuthTokenTest::true_is_true";d:0.14;s:60:"Gathuku\Mpesa\Tests\Unit\MpesaRegisterUrlsTest::true_is_true";d:0.152;s:47:"Gathuku\Mpesa\Tests\Unit\MpesaB2CTest::test_b2c";d:3.461;s:51:"Gathuku\Mpesa\Tests\Unit\MpesaB2CTest::true_is_true";d:0.146;s:61:"Gathuku\Mpesa\Tests\Unit\MpesaExpressTest::test_mpesa_express";d:12.852;s:55:"Gathuku\Mpesa\Tests\Unit\MpesaExpressTest::true_is_true";d:0.148;s:60:"Gathuku\Mpesa\Tests\Unit\MpesaSimeulateC2BTest::true_is_true";d:0.142;}}} \ No newline at end of file diff --git a/tests/Unit/MpesaExpressTest.php b/tests/Unit/MpesaExpressTest.php index 7fe0ac7..4c72d85 100644 --- a/tests/Unit/MpesaExpressTest.php +++ b/tests/Unit/MpesaExpressTest.php @@ -12,7 +12,7 @@ public function test_mpesa_express() $response = Mpesa::express(100,'254705112855','24242524','Testing Payment'); $data = json_decode($response,true); - if(isset($result['CheckoutRequestID')){ + if(isset($data['CheckoutRequestID'])){ $this->assertArrayHasKey('MerchantRequestID',$data,"response don't have MerchantRequestID"); $this->assertArrayHasKey('CheckoutRequestID',$data, "response don't have CheckoutRequestID"); $this->assertArrayHasKey('ResponseDescription',$data, "response don't have ResponseDescription");