-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Refactoring tests #25420
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
Refactoring tests #25420
Conversation
such changes should be done in 2.7 first (and then additional PRs for 2.8, 3.3, 3.4, 4.0 and master with the necessary additional changes after things have been propagated each time). |
@stof @nicolas-grekas @OskarStark Should I replicate this PR to each branch? Isn't there a better way? |
@carusogabriel Doing one PR on 2.7 is enough for now. |
@fabpot Gonna work on that! |
Done! I've also added:
|
Thank you @carusogabriel. |
This PR was merged into the 2.7 branch. Discussion ---------- Refactoring tests | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - I've refactored some tests, using: - `assertCount` instead of `count` function; - `assertArrayHasKey`, `assertArrayNotHasKey`, `assertObjectHasAttribute` and `assertObjectNotHasAttribute` instead of `isset` function; - `assertContains` instead of `in_array` function; - `assertSame` and `assertNotSame` instead os strict comparisons `===`; - `assertNotFalse` instead of strict comparisons `!==` with `false` keyword; - `assertGreaterThan`, `assertLessThan` and `assertLessThanOrEqual` for mathematical comparisons; Commits ------- 567e0ab Refactoring tests.
This PR was merged into the 3.3 branch. Discussion ---------- [HttpFoundation] Fix tests | Q | A | ------------- | --- | Branch? | 3.3 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | not yet | Fixed tickets | n/a | License | MIT | Doc PR | n/a Remains filesystem ones due to #25420, going to have a look in this PR in the next hour if nobody does before. Commits ------- ef6adb8 Fix tests
This PR was merged into the 2.7 branch. Discussion ---------- Add php_unit_dedicate_assert to PHPCS | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #25420 | License | MIT | Doc PR | - Forgot to add this in #25420 😅 Commits ------- e913b68 Add php_unit_dedicate_assert to PHPCS
This PR was merged into the 2.7 branch. Discussion ---------- Improve assertions | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Following #25420 before start other branches. Btw, the other branches are 2.8, 3.3, 3.4, 4.0 and master? Commits ------- 3d90a22 Improve assertions
This PR was merged into the 2.8 branch. Discussion ---------- Improve assertions | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Following #25420 in `2.8` branch. Commits ------- 4683f6d Improve assertions
This PR was merged into the 3.4 branch. Discussion ---------- Improve assertions | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Following #25420 in `3.4` branch. Commits ------- 829f59d Improve assertions
I've refactored some tests, using:
assertCount
instead ofcount
function;assertArrayHasKey
,assertArrayNotHasKey
,assertObjectHasAttribute
andassertObjectNotHasAttribute
instead ofisset
function;assertContains
instead ofin_array
function;assertSame
andassertNotSame
instead os strict comparisons===
;assertNotFalse
instead of strict comparisons!==
withfalse
keyword;assertGreaterThan
,assertLessThan
andassertLessThanOrEqual
for mathematical comparisons;