Php assertContains无法获得正确的输出它是如何工作的?

Php assertContains无法获得正确的输出它是如何工作的?,php,phpunit,Php,Phpunit,我有一个这样的代码,但断言不起作用$user6_通知包含user8和user10,如何检查用户通知中的用户id 只是在for循环中更改了操作。明白。$user6\u通知包含什么内容?基元或对象数组,什么类型的对象?给我们更多的细节please@Aboca数组([0]=>stdClass对象([$id]=>stdClass对象([$id]=>537cb08eb0b80586268b4651)[userId]=>user8][1]=>stdClass对象([$id]=>537cb08eb0b8058

我有一个这样的代码,但断言不起作用$user6_通知包含user8和user10,如何检查用户通知中的用户id


只是在for循环中更改了操作。明白。

$user6\u通知包含什么内容?基元或对象数组,什么类型的对象?给我们更多的细节please@Aboca数组([0]=>stdClass对象([$id]=>stdClass对象([$id]=>537cb08eb0b80586268b4651)[userId]=>user8][1]=>stdClass对象([$id]=>537cb08eb0b80586268b4652)[notifiedrid]=>user6[userId]=>user10)我认为我的迭代方式是错误的。请给我粘贴用于构造$user6\u通知的代码,我在变量转储xD$this->get('/users/notification/'.$user6[“id”])上迷路了$user6_notification=json_decode($this->response->body())$这->assertEquals(2,计数($user6_通知));foreach($user6_notification as$notification){print_r($notification->userId);$this->assertContains($user8[“id”],array($notification->userId));}
foreach ($user6_notification as $notification) {
            $this->assertContains($user8["id"],$notification->userId);
        }
foreach ($user6_notification as $notification) {
    $this->assertContains($notification->userId, array($user8["id"], $user10["id"]));
}