Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Refactoring of the TextTest class #1590

Merged
merged 7 commits into from Sep 18, 2019
Merged

Refactoring of the TextTest class #1590

merged 7 commits into from Sep 18, 2019

Conversation

stevegrunwell
Copy link
Contributor

This PR applies some minor refactoring to the TextTest class, making it easier to understand what's happening:

  1. Add a new buildGenerator() method, which creates a new instance of the text generator at the start of each test and saves it in the private $generator property — this saves a few lines of setup for each test method.
  2. Instead of a foreach loop within testTextMaxLength(), use PHPUnit's data providers to explicitly run each scenario as a separate test.
  3. For test methods that are using @expectException, explicitly add a failure message to the test to describe why the exception should have occurred.

@pimjansen
Copy link
Contributor

@stevegrunwell im pretty happy with the change. Is it possible to rebase it with latest so we can do some final checks?

@stevegrunwell
Copy link
Contributor Author

@pimjansen A fresh copy has been pushed. I've also moved the @expectedException annotations to $this->setExpectedException() as the annotation version was deprecated in PHPUnit 8.

@pimjansen
Copy link
Contributor

@stevegrunwell builds are failing, please review

@stevegrunwell
Copy link
Contributor Author

@pimjansen Apologies, type-hints and ::class resolution in some of the test methods were causing it to fail on old versions of PHP. Everything should be green, now.

@fzaninotto fzaninotto merged commit 242591b into fzaninotto:master Sep 18, 2019
@fzaninotto
Copy link
Owner

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants