Skip to content

Commit

Permalink
Update to Page Forms 5.3.4 (#92)
Browse files Browse the repository at this point in the history
* fixed title lookup for combobox fields (which changed from select2 to OOUI)
* fixed parsing API response
* fixed population of elements depending on SFS elements
* fixed deprecations
* updated CI targets
* added some node-qunit tests
* deleted obsolete files
  • Loading branch information
gesinn-it-wam committed Apr 28, 2022
1 parent 4b29a6b commit 0892796
Show file tree
Hide file tree
Showing 29 changed files with 7,843 additions and 809 deletions.
95 changes: 95 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{
"root": true,
"parserOptions": {
"ecmaVersion": 6
},
"extends": [
"wikimedia/client-es5",
"wikimedia/jquery",
"wikimedia/mediawiki"
],
"env": {
"commonjs": true
},
"rules": {
"camelcase": "off",
"comma-dangle": "off",
"comma-spacing": "off",
"computed-property-spacing": "off",
"curly": "off",
"dot-notation": "off",
"eqeqeq": "off",
"func-call-spacing": "off",
"indent": "off",
"key-spacing": "off",
"keyword-spacing": "off",
"max-len": "off",
"max-statements-per-line": "off",
"new-cap": "off",
"no-alert": "off",
"no-extra-semi": "off",
"no-implicit-coercion": "off",
"no-jquery/no-animate-toggle": "off",
"no-jquery/no-bind": "off",
"no-jquery/no-browser": "off",
"no-jquery/no-each-util": "off",
"no-jquery/no-event-shorthand": "off",
"no-jquery/no-fade": "off",
"no-jquery/no-global-selector": "off",
"no-jquery/no-grep": "off",
"no-jquery/no-in-array": "off",
"no-jquery/no-is-array": "off",
"no-jquery/no-is-numeric": "off",
"no-jquery/no-map-util": "off",
"no-jquery/no-parse-html-literal": "off",
"no-jquery/no-parse-json": "off",
"no-jquery/no-ready-shorthand": "off",
"no-jquery/no-size": "off",
"no-jquery/no-slide": "off",
"no-jquery/no-trim": "off",
"no-jquery/no-unbind": "off",
"no-jquery/no-unique": "off",
"no-mixed-spaces-and-tabs": "off",
"no-multiple-empty-lines": "off",
"no-multi-spaces": "off",
"no-octal-escape": "off",
"no-prototype-builtins": "off",
"no-redeclare": "off",
"no-restricted-syntax": "off",
"no-shadow-restricted-names": "off",
"no-tabs": "off",
"no-throw-literal": "off",
"no-undef": "off",
"no-underscore-dangle": "off",
"no-unneeded-ternary": "off",
"no-unreachable": "off",
"no-unused-vars": "off",
"no-use-before-define": "off",
"no-useless-concat": "off",
"no-useless-escape": "off",
"no-whitespace-before-property": "off",
"object-curly-spacing": "off",
"operator-linebreak": "off",
"quote-props": "off",
"quotes": "off",
"semi": "off",
"semi-spacing": "off",
"space-before-blocks": "off",
"space-before-function-paren": "off",
"spaced-comment": "off",
"space-infix-ops": "off",
"space-in-parens": "off",
"space-unary-ops": "off",
"valid-jsdoc": "off",
"wrap-iife": "off",
"yoda": "off",
"no-jquery/no-class-state": "warn",
"no-jquery/no-sizzle": "warn",
"no-jquery/variable-pattern": "warn",
"no-shadow": "warn",
"no-unreachable-loop": "warn",
"mediawiki/msg-doc": "warn",
"compat/compat": "warn",
"block-scoped-var": "warn"
}
}
40 changes: 38 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,21 @@ jobs:
page_forms_version: 5.3.4
coverage: true
experimental: true
- mediawiki_version: '1.35'
semantic_mediawiki_version: dev-master
page_forms_version: master
coverage: false
experimental: true
- mediawiki_version: '1.36'
semantic_mediawiki_version: dev-master
page_forms_version: master
coverage: false
experimental: true
- mediawiki_version: '1.37'
semantic_mediawiki_version: dev-master
page_forms_version: master
coverage: false
experimental: true

container:
image: gesinn/docker-mediawiki:${{ matrix.mediawiki_version }}
Expand Down Expand Up @@ -79,17 +94,38 @@ jobs:
tail -n5 ${{ env.MW_INST_PATH }}/LocalSettings.php
php ${{ env.MW_INST_PATH }}/maintenance/update.php --quick
- name: Run Tests
- name: Run PHPUnit Tests
run: >
php ${{ env.MW_INST_PATH }}/tests/phpunit/phpunit.php
--configuration ${{ env.MW_EXT_PATH }}/${{ env.EXT_NAME }}
--testdox
if: matrix.coverage == false

- name: Run Tests With Coverage
- name: Run PHPUnit Tests With Coverage
run: >
php ${{ env.MW_INST_PATH }}/tests/phpunit/phpunit.php
--configuration ${{ env.MW_EXT_PATH }}/${{ env.EXT_NAME }}
--testdox
--coverage-clover ${{ env.MW_INST_PATH }}/docs/coverage.xml
if: matrix.coverage == true

- name: Install Node Modules
run: >
cd ${{ env.MW_EXT_PATH }}/${{ env.EXT_NAME }} && npm ci
- name: Run Node.js Tests
run: >
cd ${{ env.MW_EXT_PATH }}/${{ env.EXT_NAME }} && npm test
if: matrix.coverage == false

- name: Run Node.js Tests With Coverage
run: >
cd ${{ env.MW_EXT_PATH }}/${{ env.EXT_NAME }} && npm run test-coverage
if: matrix.coverage == true

- name: Upload code coverage
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ env.MW_INST_PATH }}/docs/coverage.xml,${{ env.MW_EXT_PATH }}/${{ env.EXT_NAME }}/coverage/clover.xml
if: matrix.coverage == true
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ composer.lock
!.*
.idea/
.phpunit.result.cache

node_modules/
.eslintcache
.nyc_output
coverage
28 changes: 0 additions & 28 deletions .scrutinizer.yml

This file was deleted.

36 changes: 0 additions & 36 deletions .travis.yml

This file was deleted.

20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
# Semantic Forms Select

[![CI](https://github.com/SemanticMediaWiki/SemanticFormsSelect/actions/workflows/main.yml/badge.svg)](https://github.com/SemanticMediaWiki/SemanticFormsSelect/actions/workflows/main.yml)
[![Code Coverage](https://scrutinizer-ci.com/g/SemanticMediaWiki/SemanticFormsSelect/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/SemanticMediaWiki/SemanticFormsSelect/?branch=master)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/SemanticMediaWiki/SemanticFormsSelect/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/SemanticMediaWiki/SemanticFormsSelect/?branch=master)
[![codecov](https://codecov.io/gh/SemanticMediaWiki/SemanticFormsSelect/branch/master/graph/badge.svg?token=sSjXlzUDXI)](https://codecov.io/gh/SemanticMediaWiki/SemanticFormsSelect)
[![Latest Stable Version](https://poser.pugx.org/mediawiki/semantic-forms-select/version.png)](https://packagist.org/packages/mediawiki/semantic-forms-select)
[![Packagist download count](https://poser.pugx.org/mediawiki/semantic-forms-select/d/total.png)](https://packagist.org/packages/mediawiki/semantic-forms-select)

Semantic Forms Select (a.k.a. SFS) can generate a select form element with values retrieved from a `#ask` query or a parser function.

## Requirements

- PHP 5.6 or later
- MediaWiki 1.27 or later
- [Semantic MediaWiki][smw] 2.5 or later
- [Page Forms][pf] 4.0.2 or later
- PHP 7.3 or later
- MediaWiki 1.35 or later
- [Semantic MediaWiki][smw] 3.0.0 or later
- [Page Forms][pf] 5.3.0 or later

## Installation

Expand All @@ -38,15 +37,15 @@ If you do not have a "composer.local.json" file yet, create one and add the foll
```
{
"require": {
"mediawiki/semantic-forms-select": "~3.0"
"mediawiki/semantic-forms-select": "~4.0"
}
}
```

If you already have a "composer.local.json" file add the following line to the end of the "require"
section in your file:

"mediawiki/semantic-forms-select": "~3.0"
"mediawiki/semantic-forms-select": "~4.0"

Remember to add a comma to the end of the preceding line in this section.

Expand Down Expand Up @@ -87,15 +86,14 @@ Original code from https://code.google.com/p/semanticformsselect/downloads/list

## Tests

This extension provides unit and integration tests that are run by a [continues integration platform][travis]
but can also be executed using `composer phpunit` from the extension base directory.
This extension provides PHP and JavaScript tests that are run by continues integration platform
but can also be executed using `composer phpunit` and `npm ci && npm test` from the extension base directory.

## License

[GNU General Public License, version 2 or later][gpl-licence].

[gpl-licence]: https://www.gnu.org/copyleft/gpl.html
[smw]: https://github.com/SemanticMediaWiki/SemanticMediaWiki
[travis]: https://travis-ci.org/SemanticMediaWiki/SemanticFormsSelect
[pf]: https://www.mediawiki.org/wiki/Extension:Page_Forms
[composer]: https://getcomposer.org/
12 changes: 9 additions & 3 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
This file contains the RELEASE-NOTES of the Semantic Forms Select (a.k.a. SFS) extension.

### 3.1.0

This is not a realease yet.
### 4.0.0-beta

* Dropped support for MediaWiki 1.34 and lower
* Dropped support for PHP 7.2 and lower
* Dropped support for Page Forms 5.3 and lower
* Added support for Page Forms 5.3 OOUI input types
* Added support for Semantic MediaWiki 4.x
* Added QUnit tests (node-qunit)
* Fixed PHPUnit tests

### 3.0.0

Expand Down
22 changes: 19 additions & 3 deletions SemanticFormsSelect.hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class Hooks {
* @return bool
*/
public static function onSemanticFormsSelectSetup ( & $parser ) {

if ( !defined( 'PF_VERSION' ) ) {
die( '<b>Error:</b><a href="https://github.com/SemanticMediaWiki/SemanticFormsSelect/">Semantic Forms Select</a> requires the <a href="https://www.mediawiki.org/wiki/Extension:PageForms">Page Forms</a> extension. Please install and activate this extension first.' );
}
Expand All @@ -28,11 +27,28 @@ public static function onSemanticFormsSelectSetup ( & $parser ) {

return true;
}

public static function onRegistration() {

public static function onRegistration() {
if ( isset( $GLOBALS['wgAPIModules'] ) ) {
$GLOBALS['wgAPIModules']['sformsselect'] = \SFS\ApiSemanticFormsSelect::class;
}
}

/**
* Hook: ResourceLoaderTestModules
* @param array &$modules
*/
public static function onResourceLoaderTestModules( array &$modules ) {
$modules['qunit']['ext.sfs.unit'] = [
'scripts' => [
'res/sfs.js',
'tests/qunit/unit/sfs.test.js'
],
'dependencies' => [
'ext.pageforms.originalValueLookup'
],
'localBasePath' => __DIR__,
'remoteExtPath' => 'SemanticFormsSelect',
];
}
}
2 changes: 2 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fixes:
- "/var/www/html/extensions/SemanticFormsSelect/::"
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@
}
],
"require": {
"php": ">=7.2",
"php": ">=7.3",
"composer/installers": "1.*,>=1.0.1",
"mediawiki/semantic-media-wiki": "~2.5|~3.0|~4.0",
"mediawiki/page-forms": ">=4.0.2"
"mediawiki/semantic-media-wiki": "~3.0|~4.0",
"mediawiki/page-forms": ">=5.3.0"
},
"require-dev": {
"mediawiki/semantic-media-wiki": "@dev"
},
"extra": {
"branch-alias": {
"dev-master": "3.1.x-dev"
"dev-master": "4.0.x-dev"
}
},
"autoload": {
Expand Down
Loading

0 comments on commit 0892796

Please sign in to comment.