Repository navigation
fix(upgrade): bring the 2.0 upgrade up to date with Flarum 2.0.0 - #58
Merged
Merged
Conversation
- Stop setting minimum-stability: beta, now that 2.0 is stable. - Drop the workflows' php_versions input, so the reusable workflow's default (the PHP versions Flarum 2.0 supports) applies. - Require flarum-webpack-config ^3.0.6 and webpack ^5.104.1, in the upgrade and the scaffold, and update both dependencies and devDependencies. - Bring tests to PHPUnit 12: annotations become attributes, renamed assertions are renamed, stub helpers become will*() calls, and what was removed without a replacement is flagged.
imorland
marked this pull request as ready for review
October 11, 2026 11:17
imorland
added a commit
that referenced
this pull request
Oct 11, 2026
The PHPUnit 12 rewrite in #58 wrote attributes in the order the annotations were written, so a test with @dataProvider above @test got #[DataProvider] above #[Test]. The original rewriter put #[Test] first, as Flarum's own tests have it. Found by running both versions over the 1.x tests of 36 FoF extensions and core.
6 of 12 tasks
imorland
added a commit
that referenced
this pull request
Oct 11, 2026
…#60) * feat(upgrade): give each model a factory, written from its migrations Flarum 2.0 tests fill the columns a test leaves out from a model's factory, when prepareDatabase() is given the model class rather than its table. - A new upgrade step writes a factory next to each of the extension's models, from what its migrations say about the model's table, and gives the model HasFactory. A factory the extension already has is kept. - The PHPUnit step names the extension's own tables, and api_keys, by their models in prepareDatabase(). - fl make backend model generates the factory with the model. * fix(upgrade): put #[Test] first again when converting annotations The PHPUnit 12 rewrite in #58 wrote attributes in the order the annotations were written, so a test with @dataProvider above @test got #[DataProvider] above #[Test]. The original rewriter put #[Test] first, as Flarum's own tests have it. Found by running both versions over the 1.x tests of 36 FoF extensions and core.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: no issue.
Changes proposed in this pull request:
upgrade 2.0still targeted the RC period and PHPUnit 11. It no longer setsminimum-stability: beta. It drops the workflows'php_versionsinput, so the reusable workflow's default (PHP 8.3–8.5) applies, instead of writing a matrix with 8.2. It requiresflarum-webpack-config^3.0.6 (the first to load an extension's code-split chunks from its own build) and webpack ^5.104.1, in both the upgrade and the scaffold. Thepackage.jsonupdate now reaches bothdependenciesanddevDependencies; only one of them was updated before.The PHPUnit step now targets PHPUnit 12, which reads no doc-comment metadata:
@dataProvider Class::methodand@depends Class::methodbecome*Externalattributes (the provider used to be silently dropped);->will($this->returnValue(…))and its siblings becomewill*();@TODO.Reviewers should focus on:
TestCasemethods with common names (setLocale(),iniSet(),at(),expect*()) are only flagged on$this/self/static, because Flarum tests call$translator->setLocale().1.x. Every output parses, all 840@testand 46@dataProviderannotations were converted, and no TODOs were needed.Screenshot
N/A
Necessity
Confirmed
yarn testinjs/). (yarn test: 221 tests, plus Prettier, ESLint andtsc.)composer test). (N/A)Required changes:
None.