silverstripe / silverstripe/developer-docs
Improve docs around setUp and setUpBeforeClass
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 7
- Forks
- 74
- Avg merge
- 1d 14m
- Merged PRs (30d)
- 6
Description
Description
The docs for setUp and tearDown in SapphireTest are incorrect as these methods are protected now.
Additionally the docs have a section about using setUpBeforeClass in your tests:
https://github.com/silverstripe/silverstripe-framework/blame/4/docs/en/02_Developer_Guides/06_Testing/00_Unit_Testing.md#L140 (blame because there's no line-number view for markdown files 😞 )
This doesn't mention any of the caveats of using this like certain scaffolding not being ready yet - the example from community Slack being you can't Security::setCurrentUser. Personally I would generally discourage use of it in most cases as test state should not persist between individual tests.
Either way that section could be improved to warn developers better.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open docs/en/02_Developer_Guides/06_Testing/00_Unit_Testing.md and review the setUp and setUpBeforeClass sections, using the linked blame context. Confirm the current SapphireTest method visibility and document the setup caveats described in the issue; done means the guidance is accurate and clearly warns about test-state persistence.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100