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

[5.x] Simplify TestCase for addons #9573

Merged
merged 7 commits into from
Feb 23, 2024
Merged

[5.x] Simplify TestCase for addons #9573

merged 7 commits into from
Feb 23, 2024

Conversation

duncanmcclean
Copy link
Member

@duncanmcclean duncanmcclean commented Feb 22, 2024

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:

<?php

namespace Statamic\SeoPro\Tests;

use Statamic\SeoPro\ServiceProvider;
use Statamic\Extend\AddonTestCase;

abstract class TestCase extends AddonTestCase
{
    protected string $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 master Feb 23, 2024
37 checks passed
@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
Made possible because of statamic/cms#9573.
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 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.

2 participants