Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into FS#2697searchpagere…
Browse files Browse the repository at this point in the history
…adonly

Conflicts:
	inc/lang/hr/searchpage.txt
	inc/lang/ko/searchpage.txt
  • Loading branch information
Klap-in committed Sep 28, 2014
2 parents 618191d + da95727 commit 0c1b02b
Show file tree
Hide file tree
Showing 791 changed files with 35,580 additions and 24,153 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
@@ -0,0 +1,15 @@
; http://editorconfig.org/

[*]
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[inc/{geshi,phpseclib}/**]
; Use editor default (possible autodetection).
indent_style =
indent_size =
trim_trailing_whitespace = false
insert_final_newline = false
8 changes: 8 additions & 0 deletions .gitattributes
Expand Up @@ -4,3 +4,11 @@
*.gif binary
*.ico binary
*.xcf binary

.gitattributes export-ignore
.gitignore export-ignore
.editorconfig export-ignore
.travis.yml export-ignore
_test export-ignore
_cs export-ignore
lib/plugins/testing export-ignore
10 changes: 6 additions & 4 deletions .gitignore
Expand Up @@ -9,6 +9,7 @@
/conf/lang/*
/conf/plugin_lang/*
/conf/plugins.local.*
/conf/tpl/*
.htaccess
*.swp
*.bak
Expand All @@ -26,31 +27,32 @@
/data/media_attic/*
/data/meta/*
/data/pages/*
/data/tmp/*
!/data/pages/wiki/dokuwiki.txt
!/data/pages/wiki/syntax.txt
!/data/pages/wiki/welcome.txt
/data/tmp/*
/lib/tpl/*
!/lib/tpl/default
!/lib/tpl/dokuwiki
!/lib/tpl/index.php
/lib/plugins/*
!/lib/plugins/acl
!/lib/plugins/authad
!/lib/plugins/authldap
!/lib/plugins/authmysql
!/lib/plugins/authpgsql
!/lib/plugins/authplain
!/lib/plugins/acl
!/lib/plugins/config
!/lib/plugins/extension
!/lib/plugins/info
!/lib/plugins/plugin
!/lib/plugins/popularity
!/lib/plugins/revert
!/lib/plugins/safefnrecode
!/lib/plugins/testing
!/lib/plugins/usermanager
!/lib/plugins/action.php
!/lib/plugins/admin.php
!/lib/plugins/auth.php
!/lib/plugins/index.html
!/lib/plugins/remote.php
!/lib/plugins/syntax.php
lib/images/*/local/*
5 changes: 5 additions & 0 deletions .travis.yml
@@ -1,8 +1,13 @@
language: php
php:
- "5.6"
- "5.5"
- "5.4"
- "5.3"
# PHP 5.6 is not yet released, allow failures
matrix:
allow_failures:
- php: "5.6"
notifications:
irc:
channels:
Expand Down
56 changes: 19 additions & 37 deletions _test/README
Expand Up @@ -9,35 +9,28 @@ This is the test suite to automatically test various parts of DokuWiki.

===== PHPUnit Installation ======

==== via PEAR installer ====
You can install phpunit through your distribution's package manager or simply
download the newest phar file into the _test directory:

pear config-set auto_discover 1
pear install pear.phpunit.de/PHPUnit

==== via Composer ====

Include a composer.json file in your project, which can be as minimal as:

<code>
{
"require-dev": {
"phpunit/phpunit": "3.7.*"
}
}
</code>

==== via PHP archive (PHAR) ====

Download http://pear.phpunit.de/get/phpunit.phar and make it executable on your system.
cd _test/
wget https://phar.phpunit.de/phpunit.phar


===== Running all tests =====

Just change to the ''_test'' directory and run phpunit:
Just change to the ''_test'' directory and run phpunit (depending on your install
method):

cd _test/
phpunit

or

cd _test/
php phpunit.phar

===== Troubleshooting =====

PHPUnit will fail on some systems with a //headers already sent// error.
This is a known problem with PHPUnit, the error can be avoided by passing the
'--stderr' flag to phpunit:
Expand All @@ -46,8 +39,10 @@ This is a known problem with PHPUnit, the error can be avoided by passing the

On windows you may have to enable OpenSSL support for https tests.
Some of them point to httpclient_http.tests.php on the failure.
To enable HTTPS support copy the ''libeay32.dll'' and ''ssleay32.dll'' to your ''windows\system32'' folder
and add the following line to your php.ini in the extension section:
To enable HTTPS support copy the ''libeay32.dll'' and ''ssleay32.dll''
to your ''windows\system32'' folder and add the following line to your php.ini
in the extension section:

<code ini>
extension=php_openssl.dll
</code>
Expand All @@ -56,13 +51,13 @@ extension=php_openssl.dll

You can run a single test file by providing it as an argument to phpunit:

phpunit --stderr tests/inc/common_cleanText.test.php
phpunit tests/inc/common_cleanText.test.php

You can also use groups to exclude certain test from running. For example use
the following command to avoid long running test or tests accessing the
Internet.

phpunit --stderr --exclude-group slow,internet
phpunit --exclude-group slow,internet

===== Create new Tests =====

Expand All @@ -71,23 +66,10 @@ folder. Please respect the folder structure and naming convention. Inside the
file, implement a class, extending 'DokuWikiTest'. Every method, starting
with 'test' will be called as a test (e.g. 'testIfThisIsValid');


===== TODO for the test framework =====

* test cross platform compatibility: especially test windows
* update http://www.dokuwiki.org/devel:unittesting
* optional: add helper methods to TestRequest for easy form submission
* createForm(), ...
* check PHP Unit test_helpers https://github.com/sebastianbergmann/php-test-helpers


===== Migration Protocol =====

The following tests were not migrated:

* inc/indexer_idx_indexlengths (fs dependencies)
* inc/mail_send (integration test)
* inc/parser/parser_formatting
* inc/parser/xhtml_htmlphp (runkit)
* inc/parser/xhtml_links

3 changes: 3 additions & 0 deletions _test/core/DokuWikiTest.php
Expand Up @@ -115,5 +115,8 @@ public function setUp() {
// reload language
$local = $conf['lang'];
trigger_event('INIT_LANG_LOAD', $local, 'init_lang', true);

global $INPUT;
$INPUT = new Input();
}
}
5 changes: 4 additions & 1 deletion _test/phpunit.xml
@@ -1,7 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
bootstrap="bootstrap.php"
convertNoticesToExceptions="false">
convertNoticesToExceptions="false"
colors="true"
stderr="true"
>

<testsuites>
<testsuite name="DokuWiki Tests">
Expand Down
2 changes: 1 addition & 1 deletion _test/tests/inc/PassHash.test.php
Expand Up @@ -5,7 +5,7 @@
*
* most tests are in auth_password.test.php
*/
class PassHash_test extends PHPUnit_Framework_TestCase {
class PassHash_test extends DokuWikiTest {

function test_hmac(){
// known hashes taken from https://code.google.com/p/yii/issues/detail?id=1942
Expand Down
2 changes: 1 addition & 1 deletion _test/tests/inc/auth_password.test.php
@@ -1,6 +1,6 @@
<?php

class auth_password_test extends PHPUnit_Framework_TestCase {
class auth_password_test extends DokuWikiTest {

// hashes for the password foo$method, using abcdefgh as salt
var $passes = array(
Expand Down
86 changes: 86 additions & 0 deletions _test/tests/inc/cache_use.test.php
@@ -0,0 +1,86 @@
<?php

/**
* Class cache_use_test
*
* Tests if caching can actually be used
*/
class cache_use_test extends DokuWikiTest {
/** @var cache_renderer $cache */
private $cache;

function setUp() {
global $ID, $conf;
parent::setUp();

$ID = 'cached';
$file = wikiFN($ID);
$conf['cachetime'] = 0; // ensure the value is not -1, which disables caching

saveWikiText($ID, 'Content', 'Created');

$this->cache = new cache_renderer($ID, $file, 'xhtml');
$this->cache->storeCache('Test');

// set the modification times explicitly (overcome Issue #694)
$time = time();
touch($file, $time-1);
touch($this->cache->cache, $time);
}

function test_use() {
$this->markTestSkipped('Disabled until Ticket #694 has been fixed');
return;

$this->assertTrue($this->cache->useCache());
}

/**
* In all the following tests the cache should not be usable
* as such, they are meaningless if test_use didn't pass.
*
* @depends test_use
*/
function test_purge() {
/* @var Input $INPUT */
global $INPUT;
$INPUT->set('purge',1);

$this->assertFalse($this->cache->useCache());
$this->assertNotEmpty($this->cache->depends['purge']);
}

/**
* @depends test_use
*/
function test_filedependency() {
// give the dependent src file the same mtime as the cache
touch($this->cache->file, filemtime($this->cache->cache));
$this->assertFalse($this->cache->useCache());
}

/**
* @depends test_use
*/
function test_age() {
// need to age both our source file & the cache
$age = 10;
$time = time() - $age - 1; // older than age

touch($this->cache->file, $time - 1);
touch($this->cache->cache, $time);

$this->assertFalse($this->cache->useCache(array('age' => $age)));
}

/**
* @depends test_use
*/
function test_confnocaching() {
global $conf;
$conf['cachetime'] = -1; // disables renderer caching

$this->assertFalse($this->cache->useCache());
$this->assertNotEmpty($this->cache->_nocache);
}
}

0 comments on commit 0c1b02b

Please sign in to comment.