我正试图整合到签证直接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
}