使用laravel 5应用程序,并且对phpspec有问题。为什么下面的Phpspec单元测试失败,或者更准确地说,我如何才能使stdClass对象键匹配,这样它就不会失败?
我的规范文件:
function it_checks_add_starting_date_to_flow()
{
$dealflows = new \stdClass ();
this->add_starting_date_to_flow($dealflows)->shouldReturn((object)[]);
}和我正在测试的助手函数:
public static function add_starting_date_to_flow($dealflows)
{
$dealflows= new \stdClass();
return $dealflows;
}来自phpspec的我得到以下响应:
App/库/Mmdealhelpers
65 -它检查添加开始日期流预期obj:stdClass,但得到obj:stdClass。
@@ -1,1 +1,1 @@
-stdClass Object &000000001d025295000000007dd68060 ()
+stdClass Object &000000001d02529a000000007dd68060 ()
80 // ]
81 // ));
82 $this->add_starting_date_to_flow($dealflows)->shouldReturn((object)[]);
83
84 }
85
0 vendor/phpspec/phpspec/src/PhpSpec/Matcher/IdentityMatcher.php:78
throw new PhpSpec\Exception\Example\NotEqualException("Expected [obj:stdC...")
1 [internal]
spec\App\libraries\MmdealhelpersSpec->it_checks_add_starting_date_to_flow()https://stackoverflow.com/questions/29182016
复制相似问题