wiki.techinc.nl/tests/phpunit/MediaWikiTeardownPHPUnitExtension.php
Daimona Eaytoy aff3ea8938 phpunit: Use PHPUnit hooks to tear down the test DB after the last test
This resolves an existing TODO in the code. Note that hooks were
deprecated in PHPUnit 9 and replaced by events in PHPUnit 10. However,
PHPUnit 9 does not provide any alternative. Also, PHPUnit 10 has a
requirement of PHP >= 8.1, so we won't update to it any time soon.

Note that this extension isn't needed for unit tests, but it's added to
the unit config file anyway for consistency, given we're going to have a
single config file in the near future.

Bug: T227900
Change-Id: I0a79ee8a9f7f8c8a176acfad9bd26486d038d31f
2023-07-13 01:10:11 +02:00

15 lines
495 B
PHP

<?php
use PHPUnit\Runner\AfterLastTestHook;
/**
* PHPUnit extension used in integration tests to clean up the environment after the last test. This will:
* - clear the temporary job queue.
* - allow extensions to delete any temporary tables they created.
* - restore ability to connect to the real database.
*/
class MediaWikiTeardownPHPUnitExtension implements AfterLastTestHook {
public function executeAfterLastTest(): void {
MediaWikiIntegrationTestCase::teardownTestDB();
}
}