Skip to content

Commit

Permalink
fixes for master
Browse files Browse the repository at this point in the history
* adjusted CI
* removed phpunit/ExecutionTimeTestListener (not supported anymore in
  phpunit 10+; no alternative given)
* removed DummyLinker from project (was unused anyways)
  • Loading branch information
oetterer committed Jul 14, 2024
1 parent 77de9ee commit afb7d6e
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 204 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ jobs:
- mw: 'REL1_40'
php: 8.1
type: normal
experimental: true
experimental: false
- mw: 'REL1_41'
php: 8.1
type: normal
experimental: true
experimental: false
- mw: 'REL1_42'
php: 8.2
type: normal
experimental: true
experimental: false
- mw: 'master'
php: 8.3
type: normal
Expand Down
9 changes: 0 additions & 9 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,6 @@
stopOnIncomplete="false"
stopOnSkipped="false"
verbose="true">
<listeners>
<listener file="tests/phpunit/ExecutionTimeTestListener.php"
class="Mediawiki\Extension\BootstrapComponents\Tests\ExecutionTimeTestListener">
<arguments>
<boolean>true</boolean>
<integer>10</integer>
</arguments>
</listener>
</listeners>
<testsuites>
<testsuite name="bootstrap-components-unit">
<directory>tests/phpunit/Unit</directory>
Expand Down
78 changes: 0 additions & 78 deletions src/Hooks/DefaultHooksHandler.php

This file was deleted.

10 changes: 5 additions & 5 deletions src/Hooks/OutputPageParserOutput.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@

use MediaWiki\Extension\BootstrapComponents\BootstrapComponents;
use MediaWiki\Extension\BootstrapComponents\BootstrapComponentsService;
use OutputPage;
use ParserOutput;
/*
* TODO: When dropping support for 1.39, use these:
* TODO switch to these, wehen we drop support for mw < 1.40
use MediaWiki\Output\OutputPage;
use MediaWiki\Parser\ParserOutput;
*/
*/
use \OutputPage;
use \ParserOutput;

/**
* Class OutputPageParserOutput
Expand Down Expand Up @@ -115,7 +115,7 @@ protected function getContentForLaterInjection( ParserOutput $parserOutput ): st
$deferredContent = $parserOutput
->getExtensionData(BootstrapComponents::EXTENSION_DATA_DEFERRED_CONTENT_KEY );

if (empty($deferredContent) || !is_array($deferredContent)) {
if ( empty( $deferredContent ) || !is_array( $deferredContent ) ) {
return '';
}

Expand Down
22 changes: 20 additions & 2 deletions src/HooksHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
use MediaWiki\Hook\ParserFirstCallInitHook;
use MediaWiki\Hook\SetupAfterCacheHook;
use MediaWiki\MediaWikiServices;
use MediaWiki\Parser\Parser;
use \Parser;
// TODO switch to then when dropping support for mw < 1.40
// use MediaWiki\Parser\Parser;
use SMW\Utils\File;
use StripState;

Expand Down Expand Up @@ -97,6 +99,8 @@ public static function onScribuntoExternalLibraries( $engine, array &$extraLibra
*
* @see https://www.mediawiki.org/wiki/Manual:Hooks/GalleryGetModes
*
* @codeCoverageIgnore trivial
*
* @param array $modeArray
* @return bool
*/
Expand All @@ -121,7 +125,7 @@ public function onGalleryGetModes( &$modeArray ): bool
*
* @codeCoverageIgnore trivial
*
* @param \DummyLinker $linker
* @param $linker, always null (was \DummyLinker $linker)
* @param \Title $title
* @param File|\LocalFile $file
* @param array $frameParams
Expand Down Expand Up @@ -175,6 +179,20 @@ public function onInternalParseBeforeLinks( $parser, &$text, $stripState ): bool
return true;
}


/**
* Hook: OutputPageParserOutput
*
* Called after parse, before the HTML is added to the output.
*
* @see https://www.mediawiki.org/wiki/Manual:Hooks/OutputPageParserOutput
*
* @codeCoverageIgnore trivial
*
* @param \OutputPage $outputPage
* @param \ParserOutput $parserOutput
* @return void
*/
public function onOutputPageParserOutput( $outputPage, $parserOutput ): void {
// @todo check, if we need to omit execution on actions edit, submit, or history
// $action = $outputPage->parserOptions()->getUser()->getRequest()->getVal( "action" );
Expand Down
105 changes: 0 additions & 105 deletions tests/phpunit/ExecutionTimeTestListener.php

This file was deleted.

3 changes: 1 addition & 2 deletions tests/phpunit/Unit/ImageModalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace MediaWiki\Extension\BootstrapComponents\Tests\Unit;

use DummyLinker;
use File;
use LocalFile;
use MediaWiki\Extension\BootstrapComponents\BootstrapComponentsService;
Expand Down Expand Up @@ -437,7 +436,7 @@ private function createImageModalWithMocks(
$dummyLinker = null, $title = null, $file = null, $nestingController = null,
$bootstrapService = null, $parserOutputHelper = null
) {
$dummyLinker = $dummyLinker ?? $this->createMock( DummyLinker::class );
$dummyLinker = null;
$title = $title ?? $this->createMock( Title::class );
$file = $file ?? $this->createMock( LocalFile::class );
$nestingController = $nestingController ?? $this->createMock( NestingController::class );
Expand Down

0 comments on commit afb7d6e

Please sign in to comment.