Is there a way in phpunit that I could possibly assert two values for a key in an array?

前端 未结 1 923
梦谈多话
梦谈多话 2021-01-21 08:07
$array = [a => \'1\',
 b => \'2\']

For example, I want to check if a was either 1 or 3. I thought using this would work.

$this-&g         


        
相关标签:
1条回答
  • 2021-01-21 08:30

    If you want to assert that $array["a"] ("I want to check if a...") contains 1 or 3, then this will work:

    $array = ["a" => "1", "b" => "2"];
    $this->assertThat($array["a"],
        $this->logicalOr(
            $this->equalTo("1"),
            $this->equalTo("3")
    ));
    
    0 讨论(0)
提交回复
热议问题