-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wrong filtering in assertArraySubset method of PHPUnit_Framework_Assert class #2108
Comments
Thank you for your report. Please provide a minimal, self-contained, reproducing test case that shows the problem you are reporting. Without such a minimal, self-contained, reproducing test case I will not be able to investigate this issue. |
Adding a "minimal, self-contained, reproducing test case that shows the problem". <?php
class ExampleArrayAccessTest extends PHPUnit_Framework_TestCase {
public function testArrayAccessStuff() {
$arr = new ExampleArrayAccess();
$arr[0] = 1;
$arr[1] = 10;
$this->assertArraySubset([1, 10], $arr);
}
}
class ExampleArrayAccess implements ArrayAccess {
private $array = array();
public function offsetExists($offset) {
return isset($offset, $this->array);
}
public function offsetGet($offset) {
return $this->array[$offset];
}
public function offsetSet($offset, $value) {
$this->array[$offset] = $value;
}
public function offsetUnset($offset) {
unset($this->array[$offset]);
}
} First error that one will hit is:
Which means that
Which then produces the following error:
So the issue is that |
PHPUnit_Framework_Assert::assertArraySubset documented to accept array and subset arguments as array or ArrayAcces, but actually it only cheks array and subset arguments to be an array and don't do this for ArrayAccess.
The text was updated successfully, but these errors were encountered: