diff --git a/.env-40 b/.env-40
new file mode 100644
index 0000000..7afd5b3
--- /dev/null
+++ b/.env-40
@@ -0,0 +1,8 @@
+# docker images
+MW_VERSION?=1.40
+PHP_VERSION?=8.1
+DB_TYPE?=mysql
+DB_IMAGE?="mariadb:11.2"
+
+# extensions
+SMW_VERSION?=dev-master
\ No newline at end of file
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..b79b3a1
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,72 @@
+name: CI
+
+on:
+ push:
+ branches: [ master ]
+ pull_request:
+ branches: [ master ]
+ workflow_dispatch:
+
+jobs:
+
+ test:
+
+ runs-on: ubuntu-22.04
+ continue-on-error: ${{ matrix.experimental }}
+
+ strategy:
+ matrix:
+ include:
+ - mediawiki_version: '1.39'
+ smw_version: 4.2.0 # required only for JSONScript testing
+ php_version: 8.1
+ database_type: mysql
+ database_image: "mysql:8"
+ coverage: false
+ experimental: false
+ - mediawiki_version: '1.40'
+ smw_version: dev-master
+ php_version: 8.1
+ database_type: mysql
+ database_image: "mariadb:11.2"
+ coverage: true
+ experimental: false
+ - mediawiki_version: '1.42'
+ smw_version: dev-master
+ php_version: 8.2
+ database_type: mysql
+ database_image: "mariadb:11.2"
+ coverage: false
+ experimental: true
+
+ env:
+ MW_VERSION: ${{ matrix.mediawiki_version }}
+ SMW_VERSION: ${{ matrix.smw_version }}
+ PHP_VERSION: ${{ matrix.php_version }}
+ DB_TYPE: ${{ matrix.database_type }}
+ DB_IMAGE: ${{ matrix.database_image }}
+
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ with:
+ submodules: recursive
+
+ - name: Update submodules
+ run: git submodule update --init --remote
+
+ - name: Run tests
+ run: make ci
+ if: matrix.coverage == false
+
+ - name: Run tests with coverage
+ run: make ci-coverage
+ if: matrix.coverage == true
+
+ - name: Upload code coverage
+ uses: codecov/codecov-action@v4
+ with:
+ token: ${{ secrets.CODECOV_TOKEN }}
+ files: coverage/php/coverage.xml
+ if: matrix.coverage == true
\ No newline at end of file
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..2d846d0
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "build"]
+ path = build
+ url = https://github.com/gesinn-it-pub/docker-compose-ci.git
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..55af4f8
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,32 @@
+-include .env
+export
+
+# setup for docker-compose-ci build directory
+# delete "build" directory to update docker-compose-ci
+
+ifeq (,$(wildcard ./build/))
+ $(shell git submodule update --init --remote)
+endif
+
+
+EXTENSION=CreatePage
+
+# docker images
+MW_VERSION?=1.39
+PHP_VERSION?=8.1
+DB_TYPE?=mysql
+DB_IMAGE?="mysql:8"
+
+# extensions
+SMW_VERSION?=4.2.0
+
+# composer
+# Enables "composer update" inside of extension
+COMPOSER_EXT?=true
+
+# Enables node.js related tests and "npm install"
+# NODE_JS?=true
+
+
+include build/Makefile
+
diff --git a/README b/README
deleted file mode 100644
index 8d05045..0000000
--- a/README
+++ /dev/null
@@ -1,7 +0,0 @@
-These is the readme file for the Create Page extension.
-
-Extension page on mediawiki.org: https://www.mediawiki.org/wiki/Extension:Create_Page
-
-== About ==
-
-Create Page is a MediaWiki extension that allows placing an input that takes the name of a new page into pages.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..9eef38e
--- /dev/null
+++ b/README.md
@@ -0,0 +1,8 @@
+[](https://github.com/gesinn-it-pub/CreatePage/actions/workflows/ci.yml)
+[](https://codecov.io/github/gesinn-it-pub/CreatePage)
+
+# CreatePage
+
+Create Page is a MediaWiki extension that allows placing an input that takes the name of a new page into pages.
+
+Extension page on mediawiki.org: https://www.mediawiki.org/wiki/Extension:Create_Page
diff --git a/build b/build
new file mode 160000
index 0000000..0d02f49
--- /dev/null
+++ b/build
@@ -0,0 +1 @@
+Subproject commit 0d02f49e5e3ae0d967bb76ed63d9c517e5433ddf
diff --git a/codecov.yml b/codecov.yml
new file mode 100644
index 0000000..9ea2371
--- /dev/null
+++ b/codecov.yml
@@ -0,0 +1,2 @@
+fixes:
+ - "/var/www/html/extensions/CreatePage/::"
\ No newline at end of file
diff --git a/composer.json b/composer.json
index 3216c41..f811750 100644
--- a/composer.json
+++ b/composer.json
@@ -1,25 +1,34 @@
{
+ "name": "gesinn-it-pub/create-page",
+ "type": "mediawiki-extension",
"require-dev": {
"mediawiki/mediawiki-codesniffer": "45.0.0",
+ "mediawiki/mediawiki-phan-config": "0.14.0",
"mediawiki/minus-x": "1.1.3",
"php-parallel-lint/php-console-highlighter": "1.0.0",
"php-parallel-lint/php-parallel-lint": "1.4.0"
},
"scripts": {
- "fix": [
- "minus-x fix .",
- "phpcbf"
- ],
"test": [
- "parallel-lint . --exclude vendor --exclude node_modules",
- "@phpcs",
- "minus-x check ."
+ "@analyze",
+ "@phpunit"
],
- "phpcs": "phpcs -sp --cache"
- },
- "config": {
- "allow-plugins": {
- "dealerdirect/phpcodesniffer-composer-installer": true
- }
+ "test-coverage": [
+ "@analyze",
+ "@phpunit-coverage"
+ ],
+ "analyze": [
+ "@lint",
+ "@phpcs"
+ ],
+ "fix": [
+ "@phpcs-fix"
+ ],
+ "lint": "parallel-lint . --exclude vendor --exclude node_modules",
+ "phpcs": "phpcs -ps",
+ "phpcs-fix": "phpcbf -p",
+ "phpunit": "php ../../tests/phpunit/phpunit.php -c phpunit.xml.dist --testdox",
+ "phpunit-coverage": "php ../../tests/phpunit/phpunit.php -c phpunit.xml.dist --testdox --coverage-text --coverage-html coverage/php --coverage-clover coverage/php/coverage.xml",
+ "minus-x": "minus-x check ."
}
}
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
new file mode 100644
index 0000000..be3821e
--- /dev/null
+++ b/phpunit.xml.dist
@@ -0,0 +1,12 @@
+
Enter the name for a new course:
{{#createpage:Course||Create course}}" + } + ], + "tests": [ + { + "type": "parser", + "about": "Test that the create page form is displayed with the correct submit button", + "subject": "TestPage", + "request-parameters": {}, + "assert-output": { + "to-contain": [ + "", + "Create page" + ] + } + }, + { + "type": "parser", + "about": "Test create a page with a custom name in the form", + "subject": "TestPage_your_page_name", + "request-parameters": {}, + "assert-output": { + "to-contain": [ + "", + "Create page" + ] + } + }, + { + "type": "parser", + "about": "Test create a course with the correct input field and submit button", + "subject": "TestPage_create_course", + "request-parameters": {}, + "assert-output": { + "to-contain": [ + "Enter the name for a new course:
", + "