我有这样的代码,但断言不起作用。 $ user6_notification有user8和user10,如何在用户通知中检查用户ID? assertContains
foreach ($user6_notification as $notification) {
$this->assertContains($user8["id"],$notification->userId);
}
答案 0 :(得分:0)
foreach ($user6_notification as $notification) {
$this->assertContains($notification->userId, array($user8["id"], $user10["id"]));
}
刚刚更改了for循环中的操作。明白了。