我需要在phpunit中比较两个数组。我正在使用asserequals()但输出显示No Tests Executed!我在下面提到我的数组并编写代码:
$expected_arr = array('success' => 1);
$result_array =(output of print_r($result_array))
Array
(
[success] => 1
)
$this->assertEquals($arr_data,$expected_arr);
我的PHPUnit版本是5.1.3。我在Ubuntu 16上运行
更新:
<?php
require_once ('PHPUnit/Framework/TestCase.php');
class abc_auto_testing_test extends PHPUnit_Framework_TestCase
{
public $abc_id;
public $abc_answer;
public function __construct($ABC_id, $ABC_answer)
{
$this->abc_id = $ABC_id;
$this->abc_answer = $ABC_answer;
$this->test_Abc_Validate($this->abc_id, $this->abc_answer);
}
public function setUp()
{
}
public function tearDown()
{
}
public function test_Abc_Validate($abcId, $abcAnswer)
{
$expected_arr = array('success' => 1);
// var_dump($expected_arr);
$arr_data = ABC_Validate($abcId, $abcAnswer);
// var_dump($arr_data);
$this->assertEquals($arr_data,$expected_arr);
}
}
require'/var/www/data.abc.in/abc_server_crons/abc_auto_testing_bkp.php';
$ABC_identifier = $abcIdentifier;
$ABC_answer = $abcAnswer;
$validObj = new abc_auto_testing_test($ABC_identifier, $ABC_answer);
?>