This reverts commit d09a8e055b.
We have test that manipulate the event handler (eg. registering their
own events on that handler) which broke with above commit.
A better way needs to be found.
This replaces the outdated phpquery library by the newer and maintained
php-dom-wrapper. Usage is similar but not a 1:1 replacement. phpQuery is
left in but marked as deprecated.
For some reason it seems that CLI tests on github run with a execution
time limit that can't be disabled by setting the appropriate ini value.
Even more odd, the problem seems to exist on windows only (even though
the same limit is set on both OSes). In any case, this simply resets the
time limit for each test run and that seems to fix the timeout issue.
The waitForTick() method tried to be clever and return early if a second
had passed since the last call already. Unfortunatel this did not work
reliably in our tests and we often had failures on tests that required
unique revision numbers.
Pull requests for a reliable version welcome. Until the we wait a second
on each call.
Our test suite did not reset the config directory for each test class as
it does for the data directory. In addition it copied all files from the
main config directory over. Both may create an unpredictable state for
tests.
This streamlines the initialization.
You shouldn't really do this. But sometimes its so much easier to write
a test that flips an internal bit than to do it poperly(tm). Better a
risky test than none...
While it's generally frowned upon testing privates, it can often be
useful and the easier way to write tests. Eg you want to test something
complicated method that is important, but you do not want to expose it
directly to other classes...
This new method uses reflection to make access to such methods possible
from within tests without the need for intermediate classes.
* 'testcode-secedit' of https://github.com/LarsGit223/dokuwiki:
do not hide fatal exceptions during unit tests
never redirect from a redirect action
undo unecessary action routing adjustments
Test code for workflow 'show - sectionedit - save/cancel' (with modifications in test classes and 'send_redirect()' and 'act_dispatch()'.
We still need 5 to test on old php versions, but travis uses 6 for newer
PHP versions (and 5 may break on those).
Luckily both versions aren't that far apart, yet. This adds a thin
adapter class when running on 6.
Some of our tests require that at least one second has passed before
they can continue because our revisions depend on the Unix Timestamp.
Currently we use a sleep(1) for this. However this always waits a whole
second, even if the next second is already much closer or maybe already
here - especially when some processing has been done since the last
operation.
This new method waits for the next second by checking the time every
10th of a second. This might speed up some of our tests a bit.
getMock is deprecated in new PHPUnit versions and createMock is the
recommended replacement. However that one is not available in older
PHPUnit releases. Since we still support older PHP releases we have to
support older PHPUnit releases as well.
This add some compatibility functions to our TestCase class and replaces
all calls to getMock. Tested with PHPUnit 4.6.6 and 5.5.0.
In an older version of PHP a file_exists() call would issue a warning
when the file did not exist. This was fixed in later PHP releases. Since
we require PHP 5.3 now, there's no need to supress any error here
anymore. This might even give a minor performance boost.
Mostly this is for unit tests which use of \$_SERVER['REMOTE_USER']
It ensures the reference/alias connection between \$INPUT->server
and \$_SERVER is renewed before each test. Tests using TestRequest
class will replace this \$INPUT with their own.