You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+58-51Lines changed: 58 additions & 51 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,28 +6,15 @@ This package contains the source code, build scripts, and tests for the Memento
6
6
7
7
This file also contains installation information, but more comprehensive information about the extension is at: https://www.mediawiki.org/wiki/Extension:Memento
8
8
9
-
Note: the released version of this extension does not contain this file, so the target audience for this file is those who wish to build/maintain the source code.
10
-
11
-
# Directory Contents
12
-
13
-
* Makefile - the build script that does all of the magic
14
-
* README.md - this file
15
-
* TODO - list of items to address in the codebase
16
-
* Memento/ - the source code for this extension
17
-
* externals/ - git submodule linking to the code verification rules at https://gerrit.wikimedia.org/r/p/mediawiki/tools/codesniffer.git
18
-
* scripts/ - command line scripts used for testing the extension by hand
19
-
* tests/integration/ - the integration tests
20
-
* tests/lib/ - libraries needed by the tests
21
-
* tests/data/ - data used by the tests
22
-
9
+
Note: the released version of this extension does not contain this ``README.md`` file, so the target audience for this file is those who wish to build/maintain the source code.
23
10
24
11
# Installation
25
12
26
13
To install this package within MediaWiki perform the following:
27
-
* copy the Memento directory into the extensions directory of your MediaWiki installation
14
+
* copy the ``Memento`` directory into the extensions directory of your MediaWiki installation
28
15
* add the following to the LocalSettings.php file in your MediaWiki installation:
@@ -38,10 +25,6 @@ This extension has sensible defaults, but also allows the following settings to
38
25
39
26
*`$wgMementoIncludeNamespaces` - is an array of MediaWiki Namespace IDs (e.g. the integer values for Talk, Template, etc.) to include for Mementofication, default is an array containing just 0 (Main); the list of MediaWiki Namespace IDs is at https://www.mediawiki.org/wiki/Manual:Namespace
40
27
41
-
*`$wgMementoTimeNegotiationForThumbnails` - EXPERIMENTAL: MediaWiki, by default, does not preserve temporal coherence for its oldid pages. In other words, and oldid (URI-M) page will not contain the version of the image that existed when that page was created. See http://arxiv.org/pdf/1402.0928.pdf for more information on this problem in web archives.
42
-
* false - (default) do not attempt to match the old version of the image to the requested oldid page
43
-
* true - attempt to match the old version of the image to the requested oldid page
44
-
45
28
# Packaging
46
29
47
30
To package the Memento MediaWiki Extension, type the following
@@ -51,66 +34,90 @@ from this directory:
51
34
52
35
This serves to run everything needed to verify the code and package the zip for release.
53
36
54
-
# Automated Deployment for Testing
37
+
# Automated Deployment and Testing
55
38
56
-
To deploy the Memento MediaWiki Extension locally for testing, one must first indicate to the shell where MediaWiki is installed, then run the appropriate make target.
39
+
## Using Docker
40
+
41
+
Easier testing with supported MediaWiki versions is now available via Docker. First change into the directory containing the docker-compose files:
57
42
58
43
```
59
-
export MWDIR=<where your MediaWiki is installed>
60
-
make deploy
44
+
cd tests/docker-image
61
45
```
62
46
63
-
To remove the software from a MediaWiki instance, type:
47
+
48
+
Then decide which version of MediaWiki to test against. We currently test against:
49
+
* 1.31.1
50
+
* 1.32.1
51
+
52
+
Run the following to start the container for 1.31.1:
64
53
65
54
```
66
-
make undeploy
55
+
./starttestdocker.sh 1.31.1
67
56
```
68
57
69
-
# Integration Testing
58
+
**Do not forget this step!** Run the following to load the database:
70
59
71
-
Once the code is deployed, the integration tests can be run.
Running the integration tests requires phpunit and the curl command.
64
+
This extra manual step is necessary because the script does not yet know when the database has fully started.
74
65
75
-
You will need to change the test data inside tests/integration/data to reflect your MediaWiki installation URIs and appropriate expected data. Seeing as Mementos vary from site to site, it was decided not to come up with a "one size fits all" integration test set.
66
+
Change back to the directory at the top of the repository:
76
67
77
-
Example test data exists for our demo site in the 'demo-wiki' directory. To use that test set, the XML dump within tests/data/demo-wiki-data can be imported into a test MediaWiki installation using mwdumper, as described at https://www.mediawiki.org/wiki/Manual:MWDumper. DO NOT USE Special:Import or if you are going to use this dataset as it is, because mwdumper preserves the oldid values, which are the bulk of the value found in this data set.
68
+
```
69
+
cd ../../
70
+
```
78
71
79
-
**For more information on the integration tests and the test data format, consult the tests/integration/integration-test-description.html and tests/integration/how-to-read-output.txt files. Detailed test output is generated in the build/test-output directory once the integration tests are run.**
72
+
Run the tests as stated in the **Integration Testing** section.
73
+
74
+
75
+
## The hard way
80
76
81
-
Before running the tests you will need to set the following environment variables:
82
-
* TESTDATADIR - the data directory containing the datasets for your test run
83
-
* TESTUSERNAME - the username for logging into your MediaWiki instance, set to NOAUTH if no authentication needed
84
-
* TESTPASSWORD - the password that goes with TESTUSERNAME, set to NOAUTH if no authentication needed
77
+
To deploy the Memento MediaWiki Extension locally for testing, one must first indicate to the shell where MediaWiki is installed, then run the appropriate make target.
85
78
86
-
Test output is saved to build/test-output.
79
+
```
80
+
export MWDIR=<where your MediaWiki is installed>
81
+
make deploy
82
+
```
87
83
88
-
Because of all of the possible combinations of configuration options, the following Make targets are intended to test the following capabilities:
84
+
To remove the software from a MediaWiki instance, type:
89
85
90
-
* defaults-integration-test - test an installation with the default settings
86
+
```
87
+
make undeploy
88
+
```
91
89
92
-
* 302-style-time-negotiation-integration-test - test only the 302-style Time Negotiation capability of the install
90
+
# Setting Up Testing and Code Compliance
93
91
94
-
* friendly-error-with-302-style-integration-test - test the 302-style Time Negotiation error states with friendly output
92
+
If you have [composer](https://getcomposer.org/) installed, you can install this version of PHPUnit and PHP Code Sniffer by running:
95
93
96
-
Of course, the fastest development process is:
94
+
```
95
+
php /path/to/composer install
97
96
98
-
1. edit tests or change code, if necessary
99
-
2. make undeploy && make clean package deploy
100
-
3. run the integration test battery matching your deployment
97
+
export PATH=$PATH:`pwd`/vendor/bin
98
+
```
101
99
102
-
# Code compliance verification
100
+
If do not have [composer](https://getcomposer.org/), you will need to ensure that [PHP Unit](https://phpunit.de/) (``phpunit``) and [PHP Code Sniffer](https://pear.php.net/package/PHP_CodeSniffer) (``phpcs``) are in your ``PATH``.
101
+
102
+
# Integration Testing
103
+
104
+
Once the code is deployed, the integration tests can be run.
103
105
104
-
Running the code compliance requires phpcs.
106
+
Running the integration tests requires phpunit 6.5.14 and the curl command.
105
107
106
-
This git repository uses an external repository for coding convention rules, so we can update the coding convention rules at any time. The git command for performing the initial import is:
108
+
**For more information on the integration tests and the test data format, consult the tests/integration/integration-test-description.html and tests/integration/how-to-read-output.txt files. Detailed test output is generated in the build/test-output directory once the integration tests are run.**
109
+
110
+
To run integration tests, execute the following script from the root of the repository:
107
111
108
112
```
109
-
git submodule update --init
113
+
./run_default_tests.sh
110
114
```
111
115
112
-
To see if the code complies with MediaWiki's coding conventions, run:
116
+
# Code compliance verification
117
+
118
+
Running the code compliance requires phpcs. If you installed the development dependencies using ``composer`` then type the following to see if the code complies with MediaWiki's coding conventions:
0 commit comments