Skip to content

Conversation

@vjik
Copy link
Contributor

@vjik vjik commented May 18, 2021

Fix #4641

Added assertions PHPUnit\Framework\assertStringEqualIgnoringLineEndings and PHPUnit\Framework\assertStringContainsStringIgnoringLineEndings.

@vjik vjik changed the base branch from master to 9.5 May 18, 2021 12:01
@vjik vjik changed the title Fix #4641: Added assertions assertStringContainsStringIgnoringLineEndings and assertStringContainsStringIgnoringLineEndings Fix #4641: Added assertions assertStringEqualIgnoringLineEndings and assertStringContainsStringIgnoringLineEndings May 18, 2021
@sebastianbergmann
Copy link
Owner

Thank you for your contribution. I appreciate the time you invested in preparing this pull request. However, this introduces a new feature. As such, the pull request must be made against master. No new features will be added to PHPUnit 9.

…nd `PHPUnit\Framework\assertStringContainsStringIgnoringLineEndings`.
@vjik vjik changed the base branch from 9.5 to master May 19, 2021 06:01
@vjik
Copy link
Contributor Author

vjik commented May 19, 2021

Thank you for your contribution. I appreciate the time you invested in preparing this pull request. However, this introduces a new feature. As such, the pull request must be made against master. No new features will be added to PHPUnit 9.

Ok, I'm rebase code to master branch

@sebastianbergmann sebastianbergmann added feature/assertion Issues related to assertions and expectations type/enhancement A new idea that should be implemented labels May 20, 2021
@sebastianbergmann
Copy link
Owner

Merged manually, thanks.

@vjik
Copy link
Contributor Author

vjik commented Sep 17, 2021

This will be available only in 10 version?

jrfnl added a commit to Yoast/PHPUnit-Polyfills that referenced this pull request Mar 30, 2023
…sertStringEqualsStringIgnoringLineEndings() et al methods

PHPUnit 10.0.0 introduces the new `Assert::assertStringEqualsStringIgnoringLineEndings()` and `Assert::assertStringContainsStringIgnoringLineEndings()` methods.

This commit:
* Adds two traits with the same name.
    One to polyfill the methods when not available in PHPUnit.
    The other - an empty trait - to allow for `use`-ing the trait in PHPUnit versions in which the methods are already natively available.
* Logic to the custom autoloader which will load the correct trait depending on the PHPUnit version used.
* An availability test and limited functional test for the functionality polyfilled.

Note: the function name for the `private` `normalizeLineEndings()` method is a little convoluted - `normalizeLineEndingsForIgnoringLineEndingsAssertions()`.
This is intentional to prevent potential naming collisions with pre-existing end-user defined methods for the same, which may exist in other traits used in tests, which would be hard to solve due to the method only existing in the non-empty trait.

Includes:
* Adding the new polyfill to the existing `TestCases` classes.

Refs:
* sebastianbergmann/phpunit#4641
* sebastianbergmann/phpunit#4670 (and follow up commits)
* sebastianbergmann/phpunit#5279

Co-authored-by: Sergei Predvoditelev <sergey.predvoditelev@gmail.com>
Co-authored-by: Sebastian Bergmann <sb@sebastian-bergmann.de>
jrfnl added a commit to Yoast/PHPUnit-Polyfills that referenced this pull request Mar 30, 2023
…sertStringEqualsStringIgnoringLineEndings() et al methods

PHPUnit 10.0.0 introduces the new `Assert::assertStringEqualsStringIgnoringLineEndings()` and `Assert::assertStringContainsStringIgnoringLineEndings()` methods.

This commit:
* Adds two traits with the same name.
    One to polyfill the methods when not available in PHPUnit.
    The other - an empty trait - to allow for `use`-ing the trait in PHPUnit versions in which the methods are already natively available.
* Logic to the custom autoloader which will load the correct trait depending on the PHPUnit version used.
* An availability test and limited functional test for the functionality polyfilled.

Note: the function name for the `private` `normalizeLineEndings()` method is a little convoluted - `normalizeLineEndingsForIgnoringLineEndingsAssertions()`.
This is intentional to prevent potential naming collisions with pre-existing end-user defined methods for the same, which may exist in other traits used in tests, which would be hard to solve due to the method only existing in the non-empty trait.

Includes:
* Adding the new polyfill to the existing `TestCases` classes.

Refs:
* sebastianbergmann/phpunit#4641
* sebastianbergmann/phpunit#4670 (and follow up commits)
* sebastianbergmann/phpunit#5279

Co-authored-by: Sergei Predvoditelev <sergey.predvoditelev@gmail.com>
Co-authored-by: Sebastian Bergmann <sb@sebastian-bergmann.de>
jrfnl added a commit to Yoast/PHPUnit-Polyfills that referenced this pull request Mar 30, 2023
…sertStringEqualsStringIgnoringLineEndings() et al methods

PHPUnit 10.0.0 introduces the new `Assert::assertStringEqualsStringIgnoringLineEndings()` and `Assert::assertStringContainsStringIgnoringLineEndings()` methods.

This commit:
* Adds two traits with the same name.
    One to polyfill the methods when not available in PHPUnit.
    The other - an empty trait - to allow for `use`-ing the trait in PHPUnit versions in which the methods are already natively available.
* Logic to the custom autoloader which will load the correct trait depending on the PHPUnit version used.
* An availability test and limited functional test for the functionality polyfilled.

Note: the function name for the `private` `normalizeLineEndings()` method is a little convoluted - `normalizeLineEndingsForIgnoringLineEndingsAssertions()`.
This is intentional to prevent potential naming collisions with pre-existing end-user defined methods for the same, which may exist in other traits used in tests, which would be hard to solve due to the method only existing in the non-empty trait.

Includes:
* Adding the new polyfill to the existing `TestCases` classes.

Refs:
* sebastianbergmann/phpunit#4641
* sebastianbergmann/phpunit#4670 (and follow up commits)
* sebastianbergmann/phpunit#5279

Co-authored-by: Sergei Predvoditelev <sergey.predvoditelev@gmail.com>
Co-authored-by: Sebastian Bergmann <sb@sebastian-bergmann.de>
jrfnl added a commit to Yoast/PHPUnit-Polyfills that referenced this pull request Apr 1, 2023
…sertStringEqualsStringIgnoringLineEndings() et al methods

PHPUnit 10.0.0 introduces the new `Assert::assertStringEqualsStringIgnoringLineEndings()` and `Assert::assertStringContainsStringIgnoringLineEndings()` methods.

This commit:
* Adds two traits with the same name.
    One to polyfill the methods when not available in PHPUnit.
    The other - an empty trait - to allow for `use`-ing the trait in PHPUnit versions in which the methods are already natively available.
* Logic to the custom autoloader which will load the correct trait depending on the PHPUnit version used.
* An availability test and limited functional test for the functionality polyfilled.

Note: the function name for the `private` `normalizeLineEndings()` method is a little convoluted - `normalizeLineEndingsForIgnoringLineEndingsAssertions()`.
This is intentional to prevent potential naming collisions with pre-existing end-user defined methods for the same, which may exist in other traits used in tests, which would be hard to solve due to the method only existing in the non-empty trait.

Includes:
* Adding the new polyfill to the existing `TestCases` classes.

Refs:
* sebastianbergmann/phpunit#4641
* sebastianbergmann/phpunit#4670 (and follow up commits)
* sebastianbergmann/phpunit#5279

Co-authored-by: Sergei Predvoditelev <sergey.predvoditelev@gmail.com>
Co-authored-by: Sebastian Bergmann <sb@sebastian-bergmann.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature/assertion Issues related to assertions and expectations type/enhancement A new idea that should be implemented

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Assert ignoring line ending

2 participants