Commit Graph

57 Commits

Author SHA1 Message Date
Andreas Gohr 6b8df285fc added deprecated tag for phpQuery::newDocument()
for highlightin in IDE
2023-04-05 14:21:42 +02:00
Andreas Gohr 8f5f1b8709 Revert "reset Event System in TestRequest"
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.
2023-02-02 08:23:55 +01:00
Andreas Gohr d09a8e055b reset Event System in TestRequest
To better simulate requests, event registration should be redone on each
simulated request.
2023-02-01 20:38:11 +01:00
Andreas Gohr 17d97b8f3c fix type hints for new php-dom-wrapper 2022-10-27 18:47:35 +02:00
Andreas Gohr acdf738a61 replace phpquery by php-dom-wrapper #3308
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.
2022-10-19 21:10:59 +02:00
Andreas Gohr ec34bb300b Update core code to make use of sexplode()
This makes use of our own explode mechanism everywhere were we expect a
fixed number of results.
2022-10-19 15:29:26 +02:00
Andreas Gohr dfa189a857 avoid timeouts in tests
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.
2022-06-22 23:18:20 +02:00
Gerrit Uitslag 357931f346
Merge branch 'master' into revisionHandle3 2021-12-28 01:35:30 +01:00
Oscar Merida a309505210 Removes use of deprecated create_function() in teests. Replaces them with anonymous functions. Refs #3545 2021-12-13 23:18:59 -05:00
Satoshi Sahara f86a16bcc2
Merge branch 'master' into revisionHandle3 2021-11-12 18:02:11 +09:00
Satoshi Sahara e937d00471 typo 2021-10-24 16:43:31 +09:00
Syntaxseed e32b1b0ffe Fix PHPUnit fatal errors compatibility with void. 2021-09-19 15:54:51 -04:00
Syntaxseed e6a9d76f2a Method names with leading double underscore are reserved by PHP. 2021-09-19 15:46:07 -04:00
Andreas Gohr 3366d07123 fix PHP8 errors in tests
These were problems within the tests itself. There are many more
problems in the actual code.
2021-02-04 21:11:45 +01:00
Andreas Gohr 1c33cec372 add needed type hints for phpunit8
This will break a lot of plugin tests, but can't be avoided
2021-02-04 20:58:17 +01:00
Andreas Gohr bd9dab32db remove unnamespaced php unit wrapper 2021-02-04 20:58:17 +01:00
Syntaxseed 63b6cc529c Fix curly brace deprecations in _test/ directory. 2019-10-31 13:24:50 +01:00
Andreas Gohr 4af692c25a Avoid flaky tests by waiting full seconds
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.
2019-10-15 14:45:44 +02:00
Andreas Gohr 3a7140a158 moved plugin controller to Extension namespace 2019-04-20 21:55:27 +02:00
Andreas Gohr cbb44eabe0 deprecated trigger_event() in favor of a static method on Event 2019-04-20 21:48:53 +02:00
Andreas Gohr e1d9dcc8b4 First go at moving the plugin classes into their own namespace 2019-04-20 21:33:23 +02:00
Andreas Gohr ccc4c71ca8 adjusted the Input clases for PSR2
They are now in their own namespace.
2019-02-19 20:39:13 +01:00
Andreas Gohr d7e6f3915e Merge branch 'testinit' into psr2-config
* testinit:
  reset config directory for every test
2018-05-18 16:01:24 +02:00
Andreas Gohr 1c0be3ebd1 reset config directory for every test
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.
2018-05-18 15:53:16 +02:00
Andreas Gohr 836f6efbf3 add methods to test interal properties
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...
2018-05-04 12:51:27 +02:00
Andreas Gohr 210ff13322 make testing of inaccessible methods easier
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.
2018-04-13 09:06:27 +02:00
Phy 3c1490b368 remove createMock & createPartialMock polyfill, dropping support for PHPUnit 5.7- 2018-03-06 14:54:04 +08:00
Andreas Gohr 27c0c399d7 reworked notifications to the test system
No globals required anymore, somewhat more general approach to sending
data to the test system. Clean access through keys.
2017-09-02 15:44:48 +02:00
Andreas Gohr 444d58a817 no need for a global output buffer 2017-09-02 15:11:44 +02:00
Andreas Gohr 1ada9e0af1 clean up of the TestRequest object
reformatting
fixing of doc blocks
making internal vars protected
2017-09-02 14:59:12 +02:00
Andreas Gohr f5a5650781 Merge branch 'testcode-secedit' of https://github.com/LarsGit223/dokuwiki into LarsGit223-testcode-secedit
* '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()'.
2017-09-02 14:35:12 +02:00
Andreas Gohr 5e577165b1 Merge remote-tracking branch 'origin/pr/2054' into ajaxrefactor
* origin/pr/2054:
  cleaning
  extracted functions added test coverage
  allow tests against ajax requests
2017-08-29 20:45:57 +02:00
LarsDW223 572dc222f8 Test code for workflow 'show - sectionedit - save/cancel' (with modifications in test classes and 'send_redirect()' and 'act_dispatch()'. 2017-08-27 15:42:12 +02:00
Yurii K 1d7c1f1bfd response on review 2017-07-28 20:20:24 +03:00
Yurii K e4f7f55e8d allow tests against ajax requests 2017-07-24 03:03:58 +03:00
Andreas Gohr 01ef6ea290 support phpunit 5 and 6
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.
2017-03-12 09:37:59 +01:00
Michael Grosse e3eb1d750c PHPUnit 6 now only supports namespaced classes
However those classes are already supported in PHP 5.7 so we can switch
to them without breaking backward-compatibility.
2017-03-12 09:37:59 +01:00
Andreas Gohr d732617bb1 new helper method waitForTick() in DokuWikiTest
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.
2016-12-01 11:45:31 +01:00
Andreas Gohr db5867f121 fix tests for newer PHPUnit. fixes #1643
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.
2016-08-09 21:55:05 +02:00
Anders Sandblad 59752844d1 Fixed broken links to php.net and redirecting pages to php.net 2016-06-14 08:48:12 +02:00
Gerrit Uitslag f48e16abb8 reload some config settings after the conf reset in DokuWikiTest::setUp 2016-03-19 15:10:07 +01:00
Andreas Gohr 79e7937762 Remove error supression for file_exists()
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.
2015-01-07 10:47:45 +01:00
Andreas Gohr 90394abd2d fix global environment during test requests 2014-12-17 13:14:02 +01:00
Christopher Smith c01cdb709f Fix unittests broken by previous two commits
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.
2014-03-06 19:58:09 +00:00
lisps fe717f57f7 fix content check test cases
add test case new Input check
add global variables to execute
2014-02-04 10:59:06 +01:00
Christopher Smith fb0b3fbf03 update TestResponse class to return specific headers & status codes (with tests) 2013-03-22 18:01:45 +00:00
Christopher Smith 9894e7afaa extend TestRequest class to test fetch & detail; add a test to check it does 2013-03-22 17:59:23 +00:00
Michael Hamann 4f70832129 Remove global $Indexer, clear index in the testing system instead 2012-12-20 17:47:39 +01:00
Andreas Gohr 0edda900aa replace deprecated split calls FS#2583 2012-08-26 16:02:48 +02:00
Michael Hamann e3ab6fc5cb Fixed and extended PHPDoc comments and added additional @var comments 2012-07-28 11:34:47 +02:00