Skip to content
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

Iterable return types should return empty array by default #4678

Merged
merged 1 commit into from May 20, 2021
Merged

Iterable return types should return empty array by default #4678

merged 1 commit into from May 20, 2021

Conversation

Slamdunk
Copy link
Contributor

Without this fix, mocked method with traversable|Generator|iterable return types return an array with one null element:

https://3v4l.org/mR8kdU

1) ./tests/end-to-end/mock-objects/generator/return_type_declarations_generator_empty_by_default.phpt
Failed asserting that string matches format description.
--- Expected
+++ Actual
@@ @@
-array(0) {
+array(1) {
+  [0]=>
+  NULL
 }
-array(0) {
+array(1) {
+  [0]=>
+  NULL
 }
-array(0) {
+array(1) {
+  [0]=>
+  NULL
 }

@sebastianbergmann sebastianbergmann added feature/test-doubles Stubs and Mock Objects type/bug Something is broken labels May 20, 2021
@sebastianbergmann sebastianbergmann merged commit 73e9d2b into sebastianbergmann:8.5 May 20, 2021
@Slamdunk Slamdunk deleted the iterable_empty_return branch May 20, 2021 14:16
williamdes added a commit to phpmyadmin/phpmyadmin that referenced this pull request May 29, 2023
This did happen to me in Ubuntu while packaging,  until now I did not understand it correctly.
It's a phpunit bug for sure, patched in 8.5.16.
Most probably due to sebastianbergmann/phpunit#4678

```
1) PhpMyAdmin\Tests\TableTest::testDuplicateInfo
Invalid argument supplied for foreach()

libraries/classes/Table.php:944
test/classes/TableTest.php:955
phpvfscomposer://vendor/phpunit/phpunit/phpunit:60
```

Signed-off-by: William Desportes <williamdes@wdes.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/test-doubles Stubs and Mock Objects type/bug Something is broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants