| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Rename AbstractSchemaValidationTest to AbstractSchemaTest, as we're no
longer testing validation only.
- Namespace the test and make it extend MediaWikiIntegrationTestCase.
- Check that the autogenerated content from each JSON file matches
what's in the source tree. For the main schema file, this was done in
DatabaseIntegrationTest, so remove it from there.
- Whitespace differences are ignored to make future changes easier.
- Use separate methods for testing the main schema and schema changes.
- Add static methods to provide the SQL paths. The plan is to move this
logic to an abstract class, where these will be abstract methods.
Bug: T381981
Change-Id: I23bc92da73a5969bb7eb79f2598120d6aa4c41ac
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is the standard in every extension. DB schema changes are not
maintenance scripts, and therefore there's no apparent reason to have
the two things together, besides historical reasons.
Also, put each DB type in a separate directory, which wasn't the case
for MySQL before. For SQLite and Postgres schema changes, we now
follow the convention (used everywhere else, including the
generateSchemaChangeSql script) of having the DB type as the last part
of the path. This lets us generate schema changes for all DB types at
once, and without specifying the full file path.
Most files are just being renamed, the exceptions being to update
references to the old location (sometimes still referencing tables.sql).
Note that the old path is still referenced in the autogenerated comment
of schema changes SQL files. These will be regenerated in another
commit. Instead, the schema files are done now, because they're covered
by DatabaseIntegrationTest that would otherwise fail.
Bug: T382030
Change-Id: I3b4a614366d0bc629523ac40ce97d001f3b6bcf8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For starters, the property is really only used by checkDependencies(),
which in turn is only called by AbstractSchemaValidationTest. Everywhere
else, all this code was a no-op.
But for PHPUnit tests, we must not tolerate missing composer
dependencies. In fact, our PHPUnit bootstrap even runs the
CheckComposerLockUpToDate script and exits immediately if dependencies
are not up-to-date, let alone missing.
Instead, move the dependency checks to the constructor, so that they're
always executed, and throw an exception when they fail, instead of
relying on the callback. In practice:
- For PHPUnit tests there's no real difference thanks to the
composer.lock check mentioned above.
- For maintenance scripts, when dependencies are not available, we now
fail with a useful exception, instead of a generic "Class X does not
exist" message.
Bug: T381981
Change-Id: I893dc6a52262f8a63fce3ec5eecdd91dd9f339a5
|
|
|
|
|
|
|
| |
The two test functions are identical. They can as well use a single
@dataProvider to do the same as before. No coverage is lost.
Change-Id: I865b75f8e14e016ad4aa7ffdcf9e4023387b40bb
|
|
|
|
|
|
|
|
|
|
|
|
| |
With PHPUnit 9, tests without @covers tags are considered risky and emit
warnings. Not having @covers is bad practice anyway, so use
@coversNothing instead to make the intention clear, and re-enable the
phpcs rule.
Also rewrite an assertion in ResourcesTest that was bothering me.
Bug: T243600
Change-Id: I6dd683f93b6b2faed5f107be2ca7860602277fbc
|
|
This adds an option to the schema generating maintenance scripts to
validate abstract schemas and schema changes and a structure test to
validate exisiting schemas and schema changes. Schemas are also
validated when generating.
The validation for the schema doesn't impose limits on table, index or
column names as I couldn't find any reliable conventions for them.
The structure tests only cover MediaWiki itself as there is no
convention on where extensions store their abstract schema.
Ideally, auto detection would be possible for sql/, but for now
extensions have to define their own (thankfully trivial) tests.
A couple of invalid definitions were fixed thanks to these tests.
I aimed to be thorough, but not all parts of the abstract schema
are completely clear, and Doctrine's documentation is not complete.
As a result, not everything has a description field.
Bug: T298320
Change-Id: I681d265317d4d1584869142ebb23d4098c06885f
|