$array = [a => '1',
b => '2']
例如,我想检查a是1还是3。我认为使用它会起作用。
$this->assertThat(
$this->assertContains('1',$array),
$this->logicalOr(
$this->assertContains('3',$array)
));
答案 0 :(得分:3)
如果你想断言$array["a"]
(“我想检查一个......”)是否包含1或3,那么这将有效:
$array = ["a" => "1", "b" => "2"];
$this->assertThat($array["a"],
$this->logicalOr(
$this->equalTo("1"),
$this->equalTo("3")
));