Skip to content

[5.x] Simplify TestCase for addons - #9573

Merged
jasonvarga merged 7 commits into
masterfrom
addon-test-case
Feb 23, 2024
Merged

[5.x] Simplify TestCase for addons#9573
jasonvarga merged 7 commits into
masterfrom
addon-test-case

Conversation

@duncanmcclean

@duncanmccleanduncanmcclean commented Feb 22, 2024

Copy link
Copy Markdown
Member

This pull request introduces a new AddonTestCase class which can be used by addon developers to simplify their addon's TestCase.

Currently, addons need to implement a bunch of methods to boot Statamic, boot your addon's service providers & setup the addon's manifest.

Now, with the changes in this PR, the TestCase for most addons can be simplified to:

<?phpnamespaceStatamic\SeoPro\Tests;
useStatamic\SeoPro\ServiceProvider;
useStatamic\Extend\AddonTestCase;
abstractclass TestCase extends AddonTestCase
{
protectedstring$addonServiceProvider = ServiceProvider::class;
}

To Do

  • Ensure everything we "magically" load for addons in the AddonServiceProvider also get automatically loaded in tests.

@duncanmcclean
duncanmcclean marked this pull request as ready for review February 23, 2024 10:27
@duncanmcclean
duncanmcclean marked this pull request as draft February 23, 2024 10:39
@duncanmcclean
duncanmcclean marked this pull request as ready for review February 23, 2024 14:47
@jasonvarga
jasonvarga merged commit 153f6ca into masterFeb 23, 2024
@jasonvarga
jasonvarga deleted the addon-test-case branch February 23, 2024 20:54
duncanmcclean added a commit to statamic-rad-pack/runway that referenced this pull request Feb 24, 2024
duncanmcclean added a commit to statamic-rad-pack/runway that referenced this pull request Apr 9, 2024
* Change how we call the Antlers parser
* Simplify the `TestCase`
Made possible because of statamic/cms#9573.
* Tweak version in `composer.json`
* tweak version in testing matrix too
* Update orchestra/testbench
* update system requirements in docs
* Casts are now defined in a method
* Add notes about dropped support to upgrade guide
* Replace `str_slug` with `Str::slug`
* Improve UX of commands
* Fix failing tests after improving console UX
* Adopt new `casts` method
* Use the real 5.0 version constraint
* Tweak Orchestra Testbench versions & drop test script from `composer.json`
* whoopsie, fix invalid json
Sign up for freeto 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.

2 participants

@duncanmcclean@jasonvarga