如何处理类"PHPUnit_Framework_TestCase"未找到错误? [英] How do I deal with Class 'PHPUnit_Framework_TestCase' not found error?
本文介绍了如何处理类"PHPUnit_Framework_TestCase"未找到错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将其集成到签证直接API.我决定在PHP中使用它.但是,当我从他们提供的示例代码中进行一些测试时,我陷入了Fatal error: Class 'PHPUnit_Framework_TestCase' not found
错误.
I am trying to integrate to visa direct API. I decided to to it in PHP. However, as I am doing some tests from a sample code they have provided, I got stuck at Fatal error: Class 'PHPUnit_Framework_TestCase' not found
error.
自从我通过phpunit --version
.. I get PHPUnit 5.6.2 by Sebastian Bergmann and contributors.
下面是我使用PHPUnit编写的代码,有人可以指示我的错误发生在哪里吗?谢谢.
Below is my code using PHPUnit, would someone direct me where my mistake is? Thank you.
<?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 类,这样您就可以说:
You can just use TestCase class instead so you can say:
use PHPUnit\Framework\TestCase;
class MVisaTest extends TestCase {
// your tests goes here
}
这篇关于如何处理类"PHPUnit_Framework_TestCase"未找到错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文