Skip to content

Commit

Permalink
Add CI for MW 1.41 (#894)
Browse files Browse the repository at this point in the history
  • Loading branch information
paladox authored Dec 29, 2024
1 parent 503e3f4 commit ace37f7
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 18 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,21 @@ jobs:
database_image: "mariadb:11.2"
coverage: true
experimental: false
- mediawiki_version: '1.41'
smw_version: dev-master
pf_version: 5.9
sfs_version: dev-master
php_version: 8.1
database_type: mysql
database_image: "mariadb:11.2"
coverage: false
experimental: false

env:
MW_VERSION: ${{ matrix.mediawiki_version }}
SMW_VERSION: ${{ matrix.smw_version }}
PF_VERSION: ${{ matrix.pf_version }}
SFS_VERSION: ${{ matrix.sfs_version }}
PHP_VERSION: ${{ matrix.php_version }}
DB_TYPE: ${{ matrix.database_type }}
DB_IMAGE: ${{ matrix.database_image }}
Expand Down
3 changes: 3 additions & 0 deletions extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
"AutoloadNamespaces": {
"SRF\\DataTables\\": "formats/datatables"
},
"TestAutoloadNamespaces": {
"SRF\\Tests\\": "tests/phpunit/"
},
"QUnitTestModule": {
"localBasePath": "",
"remoteExtPath": "SemanticResultFormats",
Expand Down
3 changes: 2 additions & 1 deletion formats/filtered/src/View/CalendarView.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* @ingroup SemanticResultFormats
*/

use MediaWiki\MediaWikiServices;
use Message;
use SRF\Filtered\ResultItem;

Expand Down Expand Up @@ -218,7 +219,7 @@ public function getJsConfig() {
'firstDay' => ( $wgAmericanDates ? '0' : Message::newFromKey(
'srf-filtered-firstdayofweek'
)->inContentLanguage()->text() ),
'isRTL' => wfGetLangObj( true )->isRTL(),
'isRTL' => MediaWikiServices::getInstance()->getContentLanguage()->isRTL(),
];
}

Expand Down
5 changes: 3 additions & 2 deletions src/iCalendar/iCalendarFileExportPrinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace SRF\iCalendar;

use MediaWiki\MediaWikiServices;
use SMW\Query\Result\ResultArray;
use SMWDataValueFactory as DataValueFactory;
use SMWExportPrinter as FileExportPrinter;
use SMWQuery as Query;
use SMWQueryProcessor as QueryProcessor;
use SMWQueryResult as QueryResult;
use WikiPage;

/**
* Printer class for iCalendar exports
Expand Down Expand Up @@ -247,7 +247,8 @@ private function getEventParams( array $row ) {
$title = $subject->getTitle();

$params['url'] = $title->getFullURL();
$params['timestamp'] = WikiPage::factory( $title )->getTimestamp();
$params['timestamp'] = MediaWikiServices::getInstance()->getWikiPageFactory()
->newFromTitle( $title )->getTimestamp();
$params['sequence'] = $title->getLatestRevID();

return $params;
Expand Down
5 changes: 3 additions & 2 deletions src/vCard/vCardFileExportPrinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

namespace SRF\vCard;

use MediaWiki\MediaWikiServices;
use SMWExportPrinter as FileExportPrinter;
use SMWQuery as Query;
use SMWQueryProcessor as QueryProcessor;
use SMWQueryResult as QueryResult;
use SMWTimeValue as TimeValue;
use WikiPage;

/**
* Printer class for creating vCard exports
Expand Down Expand Up @@ -163,7 +163,8 @@ private function getVCardContent( $res ) {
$uri = $title->getFullURL();

// A timestamp for the last time the vCard was updated
$timestamp = WikiPage::factory( $title )->getTimestamp();
$timestamp = MediaWikiServices::getInstance()->getWikiPageFactory()
->newFromTitle( $title )->getTimestamp();
$text = $title->getText();

$vCards[] = $this->newVCard( $row, $uri, $text, $timestamp, $isPublic );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*
* @group SRF
* @group SMWExtension
* @group Database
*
* @license GPL-2.0-or-later
* @since 2.5
Expand Down
31 changes: 18 additions & 13 deletions tests/phpunit/Integration/ResourcesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace SRF\Tests\Integration;

use MediaWiki\MediaWikiServices;
use ResourceLoader;
use ResourceLoaderContext;

Expand Down Expand Up @@ -33,13 +34,7 @@ private function getSRFResourceModules() {
}

public function moduleDataProvider() {
// #501
// MW 1.33+
if ( class_exists( '\MediaWiki\MediaWikiServices' ) && method_exists( '\MediaWiki\MediaWikiServices', 'getResourceLoader' ) ) {
$resourceLoader = \MediaWiki\MediaWikiServices::getInstance()->getResourceLoader();
} else {
$resourceLoader = new ResourceLoader();
}
$resourceLoader = MediaWikiServices::getInstance()->getResourceLoader();

$context = ResourceLoaderContext::newDummyContext();
$modules = $this->getSRFResourceModules();
Expand All @@ -48,19 +43,29 @@ public function moduleDataProvider() {
}

/**
* @covers Recources
* @covers Resources
* @dataProvider moduleDataProvider
*/
public function testModulesScriptsFilesAreAccessible( $modules, ResourceLoader $resourceLoader, $context ) {
foreach ( $modules as $name => $values ) {
$module = $resourceLoader->getModule( $name );
$scripts = $module->getScript( $context );
$this->assertIsString( $scripts );
if ( version_compare( MW_VERSION, '1.41.0', '>=' ) ) {
foreach ( $modules as $name => $values ) {
$module = $resourceLoader->getModule( $name );
$scripts = $module->getScript( $context );
foreach ( $scripts['plainScripts'] as $key => $value ) {
$this->assertIsString( $value['content'] );
}
}
} else {
foreach ( $modules as $name => $values ) {
$module = $resourceLoader->getModule( $name );
$scripts = $module->getScript( $context );
$this->assertIsString( $scripts );
}
}
}

/**
* @covers Recources
* @covers Resources
* Test styles accessibility
*
* @dataProvider moduleDataProvider
Expand Down

0 comments on commit ace37f7

Please sign in to comment.