Symfony2 : PHPUnit 如何在断言中使用 'OR' 条件?

Symfony2 : PHPUnit How to use 'OR' condition in an assertion?

将 Symfony2 与 PHPUnit 结合使用,如何在断言中使用 OR 条件?

在我的例子中,客户端请求可以 return 代码 200302,但 assertEquals 期望只有一种可能性。如果代码不是 200 AND 302?

有什么方法可以抛出异常
private function check($method, $url, $code)
{
    echo "Expected code [".$code."] => URL ".$url."\n";
    $this->client->request($method, $url);
    $this->assertEquals($code, $this->client->getResponse()->getStatusCode());        
}

使用assertContainshttps://phpunit.de/manual/current/en/appendixes.assertions.html#appendixes.assertions.assertContains

private function check($method, $url, $code)
{
    echo "Expected code [".$code."] => URL ".$url."\n";
    $this->client->request($method, $url);
    $this->assertContains($this->client->getResponse()->getStatusCode(), array(200,302));        
}