phpUnit中依赖的顺序
依赖的顺序
<?php
require_once dirname(dirname(__FILE__)) . '\vendor\autoload.php';
use PHPUnit\Framework\TestCase;
class MyClassTest extends TestCase
{
/**
* @test
*/
public function one()
{
$this->assertTrue(true);
return 'one';
}
/**
* @test
*/
public function two()
{
$this->assertTrue(true);
return 'two';
}
/**
* @test
* @depends one
* @depends two
*/
public function three()
{
$expectd_value_1 = ['one', 'two'];
$expectd_value_2 = ['two', 'one'];
$this->assertEquals($expectd_value_1, func_get_args(), '当不相等,报这条错误信息');
$this->assertEquals($expectd_value_2, func_get_args(), '当不相等,报这条错误信息');
}
}
PHPUnit 6.5.3 by Sebastian Bergmann and contributors.
..F 3 / 3 (100%)
Time: 718 ms, Memory: 8.00MB
There was 1 failure:
1) MyClassTest::three
当不相等,报这条错误信息
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
Array (
- 0 => 'two'
- 1 => 'one'
+ 0 => 'one'
+ 1 => 'two'
D:\yanjing\workspace\study_test\php\MyClass.php:40
FAILURES!
Tests: 3, Assertions: 4, Failures: 1.
这是我的签名