繁体   English   中英

如何处理“ PHPUnit_Framework_TestCase”类未找到错误?

[英]How do I deal with Class 'PHPUnit_Framework_TestCase' not found error?

我正在尝试整合到Visa Direct API。 我决定在PHP中使用它。 但是,当我从它们提供的示例代码进行一些测试时,我陷入了Fatal error: Class 'PHPUnit_Framework_TestCase' not found错误。

自从我通过phpunit --version检查时,我就安装了PHPUnit。 I get PHPUnit 5.6.2 by Sebastian Bergmann and contributors.

下面是我使用PHPUnit的代码,有人可以将我的错误指示给我吗? 谢谢。

<?php
class MVisaTest extends \PHPUnit_Framework_TestCase {

    public function setUp() {
        $this->visaAPIClient = new VisaAPIClient;
        $strDate = date('Y-m-d\TH:i:s', time());
        $this->mVisaTransactionRequest = json_encode ([
            "acquirerCountryCode" => "643",
            "acquiringBin" => "400171",
            "amount" => "124.05",
            "businessApplicationId" => "CI",
            "cardAcceptor" => [
            "address" => [
            "city" => "Bangalore",
            "country" => "IND"
        ],
            "idCode" => "ID-Code123",
            "name" => "Card Accpector ABC"
        ],
            "localTransactionDateTime" => $strDate,
            "merchantCategoryCode" => "4829",
            "recipientPrimaryAccountNumber" => "4123640062698797",
            "retrievalReferenceNumber" => "430000367618",
            "senderAccountNumber" => "4541237895236",
            "senderName" => "Mohammed Qasim",
            "senderReference" => "1234",
            "systemsTraceAuditNumber" => "313042",
            "transactionCurrencyCode" => "USD",
            "transactionIdentifier" => "381228649430015"
        ]);
    }

    public function testMVisaTransactions() {
        $baseUrl = "visadirect/";
        $resourcePath = "mvisa/v1/cashinpushpayments";
        $statusCode = $this->visaAPIClient->doMutualAuthCall ( 'post', $baseUrl.$resourcePath, 'M Visa Transaction Test', $this->mVisaTransactionRequest );
        $this->assertEquals($statusCode, "200");
    }
}

您可以只使用TestCase类,这样您可以说:

use PHPUnit\Framework\TestCase;

class MVisaTest extends TestCase {

  // your tests goes here

}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM