aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authordaniel <dkinzler@wikimedia.org>2025-03-17 08:16:47 +0100
committerdaniel <dkinzler@wikimedia.org>2025-03-20 21:22:55 +0100
commit33c7de7265b34d896a31e3ba32e58904d19894df (patch)
treec949ae890bd6fdf890efdd9ed3982f147e197311 /tests
parent6317a00b3fac1b67c77cef87184744c5674ae7db (diff)
downloadmediawikicore-33c7de7265b34d896a31e3ba32e58904d19894df.tar.gz
mediawikicore-33c7de7265b34d896a31e3ba32e58904d19894df.zip
extension.json: DomainEventIngresses instead of DomainEventSubscribers
Why: - "ingress" is the more meaningful concept when implementing listeners What: - Add support for DomainEventSubscribers in extension.json Bug: T389033 Change-Id: I458bd7cd439a2e3213458d994cf87affa5da966b
Diffstat (limited to 'tests')
-rw-r--r--tests/phpunit/includes/registration/ExtensionRegistrationTest.php2
-rw-r--r--tests/phpunit/unit/includes/registration/ExtensionProcessorTest.php45
2 files changed, 37 insertions, 10 deletions
diff --git a/tests/phpunit/includes/registration/ExtensionRegistrationTest.php b/tests/phpunit/includes/registration/ExtensionRegistrationTest.php
index b17aa67afdef..bf195a36a0aa 100644
--- a/tests/phpunit/includes/registration/ExtensionRegistrationTest.php
+++ b/tests/phpunit/includes/registration/ExtensionRegistrationTest.php
@@ -138,7 +138,7 @@ class ExtensionRegistrationTest extends MediaWikiIntegrationTestCase {
];
$manifest = [
- 'DomainEventSubscribers' => [ $subscriber ]
+ 'DomainEventIngresses' => [ $subscriber ]
];
$file = $this->makeManifestFile( $manifest );
diff --git a/tests/phpunit/unit/includes/registration/ExtensionProcessorTest.php b/tests/phpunit/unit/includes/registration/ExtensionProcessorTest.php
index f3a611b99bd1..a85e07a7ed0b 100644
--- a/tests/phpunit/unit/includes/registration/ExtensionProcessorTest.php
+++ b/tests/phpunit/unit/includes/registration/ExtensionProcessorTest.php
@@ -596,15 +596,42 @@ class ExtensionProcessorTest extends MediaWikiUnitTestCase {
$processor->getExtractedInfo();
}
- public function provideDomainEventDomainEventSubscribers() {
+ public function provideDomainEventDomainEventIngresses() {
// Format:
- // Current DomainEventSubscribers attribute
+ // Current attributes
// Content in extension.json
- // Expected DomainEventSubscribers attribute
+ // Expected DomainEventIngresses attribute
return [
- [
+ 'DomainEventIngresses' => [
+ [
+ 'DomainEventIngresses' => [
+ [ 'events' => [ 'FooDone' ], 'factory' => 'PriorCallback' ]
+ ]
+ ],
+ [
+ 'DomainEventIngresses' => [
+ [
+ 'events' => [ 'FooDone', 'BarDone', ],
+ 'class' => 'FooClass',
+ 'services' => [],
+ ],
+ ]
+ ] + self::$default,
[
- [ 'events' => [ 'FooDone' ], 'factory' => 'PriorCallback' ]
+ [ 'events' => [ 'FooDone' ], 'factory' => 'PriorCallback' ],
+ [
+ 'events' => [ 'FooDone', 'BarDone', ],
+ 'class' => 'FooClass',
+ 'services' => [],
+ 'extensionPath' => $this->getExtensionPath()
+ ]
+ ]
+ ],
+ 'DomainEventSubscriber (deprecated, T389033)' => [
+ [
+ 'DomainEventIngresses' => [
+ [ 'events' => [ 'FooDone' ], 'factory' => 'PriorCallback' ]
+ ]
],
[
'DomainEventSubscribers' => [
@@ -629,13 +656,13 @@ class ExtensionProcessorTest extends MediaWikiUnitTestCase {
}
/**
- * @dataProvider provideDomainEventDomainEventSubscribers
+ * @dataProvider provideDomainEventDomainEventIngresses
*/
- public function testDomainEventDomainEventSubscribers( $pre, $info, $expected ) {
- $processor = new MockExtensionProcessor( [ 'attributes' => [ 'DomainEventSubscribers' => $pre ] ] );
+ public function testDomainEventDomainEventIngresses( $pre, $info, $expected ) {
+ $processor = new MockExtensionProcessor( [ 'attributes' => $pre ] );
$processor->extractInfo( $this->extensionPath, $info, 1 );
$extracted = $processor->getExtractedInfo();
- $this->assertEquals( $expected, $extracted['attributes']['DomainEventSubscribers'] );
+ $this->assertEquals( $expected, $extracted['attributes']['DomainEventIngresses'] );
}
public function testExtractConfig1() {