contrib / mw-to-git / t / READMEon commit Merge branch 'va/mailinfo-doc-typofix' (5bfc50d)
   1Tests for Mediawiki-to-Git
   2==========================
   3
   4Introduction
   5------------
   6This manual describes how to install the git-remote-mediawiki test
   7environment on a machine with git installed on it.
   8
   9Prerequisite
  10------------
  11
  12In order to run this test environment correctly, you will need to
  13install the following packages (Debian/Ubuntu names, may need to be
  14adapted for another distribution):
  15
  16* lighttpd
  17* php5
  18* php5-cgi
  19* php5-cli
  20* php5-curl
  21* php5-sqlite
  22
  23Principles and Technical Choices
  24--------------------------------
  25
  26The test environment makes it easy to install and manipulate one or
  27several MediaWiki instances. To allow developers to run the testsuite
  28easily, the environment does not require root privilege (except to
  29install the required packages if needed). It starts a webserver
  30instance on the user's account (using lighttpd greatly helps for
  31that), and does not need a separate database daemon (thanks to the use
  32of sqlite).
  33
  34Run the test environment
  35------------------------
  36
  37Install a new wiki
  38~~~~~~~~~~~~~~~~~~
  39
  40Once you have all the prerequisite, you need to install a MediaWiki
  41instance on your machine. If you already have one, it is still
  42strongly recommended to install one with the script provided. Here's
  43how to work it:
  44
  45a. change directory to contrib/mw-to-git/t/
  46b. if needed, edit test.config to choose your installation parameters
  47c. run `./install-wiki.sh install`
  48d. check on your favourite web browser if your wiki is correctly
  49   installed.
  50
  51Remove an existing wiki
  52~~~~~~~~~~~~~~~~~~~~~~~
  53
  54Edit the file test.config to fit the wiki you want to delete, and then
  55execute the command `./install-wiki.sh delete` from the
  56contrib/mw-to-git/t directory.
  57
  58Run the existing tests
  59~~~~~~~~~~~~~~~~~~~~~~
  60
  61The provided tests are currently in the `contrib/mw-to-git/t` directory.
  62The files are all the t936[0-9]-*.sh shell scripts.
  63
  64a. Run all tests:
  65To do so, run "make test" from the contrib/mw-to-git/ directory.
  66
  67b. Run a specific test:
  68To run a given test <test_name>, run ./<test_name> from the
  69contrib/mw-to-git/t directory.
  70
  71How to create new tests
  72-----------------------
  73
  74Available functions
  75~~~~~~~~~~~~~~~~~~~
  76
  77The test environment of git-remote-mediawiki provides some functions
  78useful to test its behaviour. for more details about the functions'
  79parameters, please refer to the `test-gitmw-lib.sh` and
  80`test-gitmw.pl` files.
  81
  82** `test_check_wiki_precond`:
  83Check if the tests must be skipped or not. Please use this function
  84at the beginning of each new test file.
  85
  86** `wiki_getpage`:
  87Fetch a given page from the wiki and puts its content in the
  88directory in parameter.
  89
  90** `wiki_delete_page`:
  91Delete a given page from the wiki.
  92
  93** `wiki_edit_page`:
  94Create or modify a given page in the wiki. You can specify several
  95parameters like a summary for the page edition, or add the page to a
  96given category.
  97See test-gitmw.pl for more details.
  98
  99** `wiki_getallpage`:
 100Fetch all pages from the wiki into a given directory. The directory
 101is created if it does not exists.
 102
 103** `test_diff_directories`:
 104Compare the content of two directories. The content must be the same.
 105Use this function to compare the content of a git directory and a wiki
 106one created by wiki_getallpage.
 107
 108** `test_contains_N_files`:
 109Check if the given directory contains a given number of file.
 110
 111** `wiki_page_exists`:
 112Tests if a given page exists on the wiki.
 113
 114** `wiki_reset`:
 115Reset the wiki, i.e. flush the database. Use this function at the
 116beginning of each new test, except if the test re-uses the same wiki
 117(and history) as the previous test.
 118
 119How to write a new test
 120~~~~~~~~~~~~~~~~~~~~~~~
 121
 122Please, follow the standards given by git. See git/t/README.
 123New file should be named as t936[0-9]-*.sh.
 124Be sure to reset your wiki regulary with the function `wiki_reset`.