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

assertContains() and object equality #3511

Closed
sebastianbergmann opened this issue Feb 5, 2019 · 0 comments
Closed

assertContains() and object equality #3511

sebastianbergmann opened this issue Feb 5, 2019 · 0 comments

Comments

@sebastianbergmann
Copy link
Owner

@sebastianbergmann sebastianbergmann commented Feb 5, 2019

As part of #3422, assertStringContainsString(), assertStringContainsStringIgnoringCase(), assertStringNotContainsString(), and assertStringNotContainsStringIgnoringCase() were introduced in PHPUnit 7.5 to separate the use cases that operate on strings from assertContains(). This was good.

Also as part of #3422, and implemented in #3425, optional parameters for assertContains() that have an effect when non-string haystacks (read: iterable haystacks) are used, were deprecated. The result of this is that, once these optional parameters are completely removed in PHPUnit 9 (see #3426), there is currently no way to assert that an object is contained in an iterable while using == instead of ===. This is bad and something should be done about it.

The original implementation of #3422 in 2975888 introduced new assertions assertIterableContains() and assertIterableContainsSame(), for instance, to support the two separate use cases of asserting that an object is contained in an iterable, once using == and once using ===, respectively. This idea was abandoned in order to avoid additional backward compatibility breaks that would have resulted from deprecating the original assertContains() methods.

@sebastianbergmann sebastianbergmann added this to the PHPUnit 8.1 milestone Feb 5, 2019
@sebastianbergmann sebastianbergmann removed this from the PHPUnit 8.1 milestone Feb 5, 2019
jrfnl added a commit to jrfnl/wordpress-develop-official that referenced this issue Aug 16, 2020
Since PHPUnit 8.0.2, the `assertContains()` method when checking whether a value exists in an array will do a strict type comparison of the values.

This caused a couple of tests to fail.

Using the correct data type in the test fixes that.

Refs:
* https://github.com/sebastianbergmann/phpunit/blob/8.0.6/ChangeLog-8.0.md#802---2019-02-07
* sebastianbergmann/phpunit#3511
* sebastianbergmann/phpunit@6205f33
jrfnl added a commit to jrfnl/wordpress-develop-official that referenced this issue Aug 16, 2020
Since PHPUnit 8.0.2, the `assertContains()` method when checking whether a value exists in an array will do a strict type comparison of the values.

This caused a couple of tests to fail.

Using the correct data type in the test fixes that.

Refs:
* https://github.com/sebastianbergmann/phpunit/blob/8.0.6/ChangeLog-8.0.md#802---2019-02-07
* sebastianbergmann/phpunit#3511
* sebastianbergmann/phpunit@6205f33
jrfnl added a commit to jrfnl/wordpress-develop-official that referenced this issue Aug 16, 2020
Since PHPUnit 8.0.2, the `assertContains()` method when checking whether a value exists in an array will do a strict type comparison of the values.

This caused a couple of tests to fail.

Using the correct data type in the test fixes that.

Refs:
* https://github.com/sebastianbergmann/phpunit/blob/8.0.6/ChangeLog-8.0.md#802---2019-02-07
* sebastianbergmann/phpunit#3511
* sebastianbergmann/phpunit@6205f33
jrfnl added a commit to jrfnl/wordpress-develop-official that referenced this issue Aug 21, 2020
Since PHPUnit 8.0.2, the `assertContains()` method when checking whether a value exists in an array will do a strict type comparison of the values.

This caused a couple of tests to fail.

Using the correct data type in the test fixes that.

Refs:
* https://github.com/sebastianbergmann/phpunit/blob/8.0.6/ChangeLog-8.0.md#802---2019-02-07
* sebastianbergmann/phpunit#3511
* sebastianbergmann/phpunit@6205f33
jrfnl added a commit to jrfnl/wordpress-develop-official that referenced this issue Jul 22, 2021
…ng due to `assertContains()` using strict checking

Since PHPUnit 8.0.2, the `assertContains()` method when checking whether a value exists in an array will do a strict type comparison of the values.

This caused a couple of tests to fail.

Using the correct data type in the test fixes that.

Refs:
* https://github.com/sebastianbergmann/phpunit/blob/8.0.6/ChangeLog-8.0.md#802---2019-02-07
* sebastianbergmann/phpunit#3511
* sebastianbergmann/phpunit@6205f33
jrfnl added a commit to jrfnl/wordpress-develop-official that referenced this issue Jul 26, 2021
…ng due to `assertContains()` using strict checking

Since PHPUnit 8.0.2, the `assertContains()` method when checking whether a value exists in an array will do a strict type comparison of the values.

This caused a couple of tests to fail.

Using the correct data type in the test fixes that.

Refs:
* https://github.com/sebastianbergmann/phpunit/blob/8.0.6/ChangeLog-8.0.md#802---2019-02-07
* sebastianbergmann/phpunit#3511
* sebastianbergmann/phpunit@6205f33
jrfnl added a commit to jrfnl/wordpress-develop-official that referenced this issue Jul 30, 2021
…ng due to `assertContains()` using strict checking

Since PHPUnit 8.0.2, the `assertContains()` method when checking whether a value exists in an array will do a strict type comparison of the values.

This caused a couple of tests to fail.

Using the correct data type in the test fixes that.

Refs:
* https://github.com/sebastianbergmann/phpunit/blob/8.0.6/ChangeLog-8.0.md#802---2019-02-07
* sebastianbergmann/phpunit#3511
* sebastianbergmann/phpunit@6205f33
jrfnl added a commit to jrfnl/wordpress-develop-official that referenced this issue Aug 6, 2021
…ng due to `assertContains()` using strict checking

Since PHPUnit 8.0.2, the `assertContains()` method when checking whether a value exists in an array will do a strict type comparison of the values.

This caused a couple of tests to fail.

Using the correct data type in the test fixes that.

Refs:
* https://github.com/sebastianbergmann/phpunit/blob/8.0.6/ChangeLog-8.0.md#802---2019-02-07
* sebastianbergmann/phpunit#3511
* sebastianbergmann/phpunit@6205f33
jrfnl added a commit to jrfnl/wordpress-develop-official that referenced this issue Aug 6, 2021
Since PHPUnit 8.0.2, the `assertContains()` method when checking whether a value exists in an array will do a strict type comparison of the values.

This caused a couple of tests to fail.

Using the correct data type in the test fixes that.

Refs:
* https://github.com/sebastianbergmann/phpunit/blob/8.0.6/ChangeLog-8.0.md#802---2019-02-07
* sebastianbergmann/phpunit#3511
* sebastianbergmann/phpunit@6205f33
jrfnl added a commit to jrfnl/wordpress-develop-official that referenced this issue Aug 7, 2021
Since PHPUnit 8.0.2, the `assertContains()` method when checking whether a value exists in an array will do a strict type comparison of the values.

This caused a couple of tests to fail.

Using the correct data type in the test fixes that.

Refs:
* https://github.com/sebastianbergmann/phpunit/blob/8.0.6/ChangeLog-8.0.md#802---2019-02-07
* sebastianbergmann/phpunit#3511
* sebastianbergmann/phpunit@6205f33
jrfnl added a commit to jrfnl/wordpress-develop-official that referenced this issue Aug 7, 2021
Since PHPUnit 8.0.2, the `assertContains()` method when checking whether a value exists in an array will do a strict type comparison of the values.

This caused a couple of tests to fail.

Using the correct data type in the test fixes that.

Refs:
* https://github.com/sebastianbergmann/phpunit/blob/8.0.6/ChangeLog-8.0.md#802---2019-02-07
* sebastianbergmann/phpunit#3511
* sebastianbergmann/phpunit@6205f33
pento pushed a commit to WordPress/wordpress-develop that referenced this issue Aug 7, 2021
…ing.

Since PHPUnit 8.0.2, the `assertContains()` method, when checking whether a value exists in an array, will do a strict type comparison of the values.

This caused a couple of tests to fail. Using the correct data type in the test fixes that.

References:
* https://github.com/sebastianbergmann/phpunit/blob/8.0.6/ChangeLog-8.0.md#802---2019-02-07
* sebastianbergmann/phpunit#3511
* sebastianbergmann/phpunit@6205f33

Follow-up to [51559-51570].

Props jrf.
See #46149.

git-svn-id: https://develop.svn.wordpress.org/trunk@51571 602fd350-edb4-49c9-b593-d223f7449a82
nylen pushed a commit to nylen/wordpress-develop-svn that referenced this issue Aug 7, 2021
…ing.

Since PHPUnit 8.0.2, the `assertContains()` method, when checking whether a value exists in an array, will do a strict type comparison of the values.

This caused a couple of tests to fail. Using the correct data type in the test fixes that.

References:
* https://github.com/sebastianbergmann/phpunit/blob/8.0.6/ChangeLog-8.0.md#802---2019-02-07
* sebastianbergmann/phpunit#3511
* sebastianbergmann/phpunit@6205f33

Follow-up to [51559-51570].

Props jrf.
See #46149.

git-svn-id: https://develop.svn.wordpress.org/trunk@51571 602fd350-edb4-49c9-b593-d223f7449a82
markjaquith pushed a commit to markjaquith/WordPress that referenced this issue Aug 7, 2021
…ing.

Since PHPUnit 8.0.2, the `assertContains()` method, when checking whether a value exists in an array, will do a strict type comparison of the values.

This caused a couple of tests to fail. Using the correct data type in the test fixes that.

References:
* https://github.com/sebastianbergmann/phpunit/blob/8.0.6/ChangeLog-8.0.md#802---2019-02-07
* sebastianbergmann/phpunit#3511
* sebastianbergmann/phpunit@6205f33

Follow-up to [51559-51570].

Props jrf.
See #46149.
Built from https://develop.svn.wordpress.org/trunk@51571


git-svn-id: http://core.svn.wordpress.org/trunk@51182 1a063a9b-81f0-0310-95a4-ce76da25c4cd
gMagicScott pushed a commit to gMagicScott/core.wordpress-mirror that referenced this issue Aug 7, 2021
…ing.

Since PHPUnit 8.0.2, the `assertContains()` method, when checking whether a value exists in an array, will do a strict type comparison of the values.

This caused a couple of tests to fail. Using the correct data type in the test fixes that.

References:
* https://github.com/sebastianbergmann/phpunit/blob/8.0.6/ChangeLog-8.0.md#802---2019-02-07
* sebastianbergmann/phpunit#3511
* sebastianbergmann/phpunit@6205f33

Follow-up to [51559-51570].

Props jrf.
See #46149.
Built from https://develop.svn.wordpress.org/trunk@51571


git-svn-id: https://core.svn.wordpress.org/trunk@51182 1a063a9b-81f0-0310-95a4-ce76da25c4cd
0aveRyan pushed a commit to 0aveRyan/wordpress-develop that referenced this issue Aug 12, 2021
…ing.

Since PHPUnit 8.0.2, the `assertContains()` method, when checking whether a value exists in an array, will do a strict type comparison of the values.

This caused a couple of tests to fail. Using the correct data type in the test fixes that.

References:
* https://github.com/sebastianbergmann/phpunit/blob/8.0.6/ChangeLog-8.0.md#802---2019-02-07
* sebastianbergmann/phpunit#3511
* sebastianbergmann/phpunit@6205f33

Follow-up to [51559-51570].

Props jrf.
See #46149.

git-svn-id: https://develop.svn.wordpress.org/trunk@51571 602fd350-edb4-49c9-b593-d223f7449a82
mattyrob added a commit to mattyrob/ClassicPress that referenced this issue Oct 9, 2021
…trict checking.

Since PHPUnit 8.0.2, the `assertContains()` method, when checking whether a value exists in an array, will do a strict type comparison of the values.

This caused a couple of tests to fail. Using the correct data type in the test fixes that.

References:
* https://github.com/sebastianbergmann/phpunit/blob/8.0.6/ChangeLog-8.0.mdhttps://core.trac.wordpress.org/ticket/802---2019-02-07
* sebastianbergmann/phpunit#3511
* sebastianbergmann/phpunit@6205f33

Follow-up to https://core.trac.wordpress.org/log/?revs=51559-51570.

WP:Props jrf.
See https://core.trac.wordpress.org/ticket/46149.

Conflicts:
- tests/phpunit/tests/comment/getPageOfComment.php
- tests/phpunit/tests/rest-api/rest-term-meta-fields.php

---

Merges https://core.trac.wordpress.org/changeset/51571 / WordPress/wordpress-develop@60dcae9 to ClassicPress.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant