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

simplify tests #99

Merged
merged 2 commits into from
Dec 4, 2020
Merged

simplify tests #99

merged 2 commits into from
Dec 4, 2020

Conversation

IonBazan
Copy link

@IonBazan IonBazan commented Dec 2, 2020

What is the reason for this PR?

This PR removes a lot of duplicated code and refactors all the tests. This replaces the previous PR without style changes (sorry for that) #90.

Summary of changes

  • Initializing Generator instance for each test in setUp method
  • Sets the seed to 1 to make results predictable
  • Adding protected function getProviders(): iterable allowing developers to easily specify providers needed in the test
  • Migrated most of $this->assert* and $this->fail() to static calls
  • Uses dedicated assertNotContains or assertGreaterThan assertions instead of asserting that comparison returns false

Review checklist

  • All checks have passed
  • Changes are approved by maintainer

@mfn
Copy link

mfn commented Dec 2, 2020

Migrated most of $this->assert* and $this->fail() to static calls

This should be enforced via the style checker so no manual work and future contributions automatically adhere to the same style, see #90 (comment)

@IonBazan
Copy link
Author

IonBazan commented Dec 2, 2020

@mfn Unfortunately, StyleCI does not support php_unit_test_case_static_method_calls fixer: https://github.styleci.io/analyses/Yjmr4G

@GrahamCampbell
Copy link
Member

StyleCI will do soon. :)

@bram-pkg
Copy link
Member

bram-pkg commented Dec 2, 2020

Can this be merged? @GrahamCampbell

@GrahamCampbell GrahamCampbell merged commit 430bc94 into FakerPHP:main Dec 4, 2020
@GrahamCampbell GrahamCampbell mentioned this pull request Dec 4, 2020
6 tasks
@IonBazan IonBazan deleted the test-refactor2 branch December 4, 2020 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants