| #
47a02a10 |
| 04-Jun-2026 |
Andreas Gohr <gohr@cosmocode.de> |
Parsing: make parse syntax a per-parse value, drop ModeInterface
The active parse's syntax flavour is a per-parse question, not process- global state: within a single request a plugin can render bun
Parsing: make parse syntax a per-parse value, drop ModeInterface
The active parse's syntax flavour is a per-parse question, not process- global state: within a single request a plugin can render bundled DokuWiki-syntax text inside an otherwise-Markdown page. Yet ModeRegistry was a singleton that read $conf['syntax'] and the $PARSER_MODES global, and every mode reached it through ModeRegistry::getInstance() — so the flavour lived in shared mutable state that two parses in one request would fight over.
Make the registry a short-lived value instead:
- ModeRegistry is constructed once per parse with an explicit $syntax and injected into Parser, Handler and every mode. getSyntax() / isDwPreferred() / isMdPreferred() consult $this->syntax; the DOKU_UNITTEST-gated mode-list cache hack is gone (each registry is fresh, nothing to invalidate). - p_get_instructions() is now the single place in the pipeline where $conf['syntax'] is read; from there the flavour travels as a parameter. No code under inc/Parsing/ reads $conf['syntax'] directly anymore — the five syntax-reading modes (Preformatted, GfmHr, GfmEscape, Externallink, GfmQuote) route through $this->registry.
Keep the two concepts apart, as documented in the ModeRegistry and AbstractMode docblocks: the user's configured *preference* stays in $conf['syntax'] for UI code (toolbar, settings), while the active parse's syntax is a parameter carried by the registry.
$PARSER_MODES is demoted to a deprecated, read-only mirror, published during loadPluginModes() — third-party syntax plugins (columnlist, alphalist2, phpwikify, skipentity) and the bundled info plugin read the global directly, often from their constructors, so the taxonomy must stay visible there. No core code reads the mirror.
Fold ModeInterface into AbstractMode while here: getSort()/handle() are abstract, the connect callbacks carry defaults, and the public $Lexer "FIXME should be done by setter" becomes setLexer()/getLexer() injected by Parser::addMode() alongside the registry. Nested-content resolution moves to the allowedCategories()/filterAllowedModes() hooks, resolved once when the registry is attached.
Tests build their own parser/registry through ParserTestBase::setSyntax() instead of mutating $conf and calling the removed ModeRegistry::reset().
show more ...
|
| #
c8dd1b9d |
| 16-Apr-2026 |
Andreas Gohr <andi@splitbrain.org> |
introduce ModeRegistry to encapsulate parser mode categories
Replace the global $PARSER_MODES definition in inc/parser/parser.php with a ModeRegistry singleton that initializes and manages the mode
introduce ModeRegistry to encapsulate parser mode categories
Replace the global $PARSER_MODES definition in inc/parser/parser.php with a ModeRegistry singleton that initializes and manages the mode categories. The global array is still populated for backward compatibility with plugins that access it directly.
Mode constructors now use ModeRegistry::getModesForCategories() instead of accessing the global directly. p_get_parsermodes() and p_sort_modes() are moved to inc/deprecated.php as thin wrappers.
show more ...
|
| #
e6d2a179 |
| 06-Jan-2024 |
Andreas Gohr <andi@splitbrain.org> |
use private IP addresses in tests
|
| #
acdf738a |
| 19-Oct-2022 |
Andreas Gohr <andi@splitbrain.org> |
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
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.
show more ...
|
| #
3feb137a |
| 02-Jun-2020 |
Andreas Gohr <andi@splitbrain.org> |
run all tests without mbstring support
The setup we had, where we tried to disable mbstring on a perclass basis did not actually work because the define is set up in an early include already.
Ideal
run all tests without mbstring support
The setup we had, where we tried to disable mbstring on a perclass basis did not actually work because the define is set up in an early include already.
Ideally we should probably make the check a static instead of a constant.
show more ...
|
| #
031cbb02 |
| 12-Mar-2019 |
Phy <git@phy25.com> |
fix Windows tests for #2702
Currently DOKU_INC, DOKU_CONF in test bootstrap is not consistent with our `fullpath()`, causing the concatenated expected string in styleutils_cssstyleini_test not corre
fix Windows tests for #2702
Currently DOKU_INC, DOKU_CONF in test bootstrap is not consistent with our `fullpath()`, causing the concatenated expected string in styleutils_cssstyleini_test not correct in Windows; this patch use str_replace to turn Windows separator into Linux ones.
show more ...
|
| #
1c0be3eb |
| 18-May-2018 |
Andreas Gohr <andi@splitbrain.org> |
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 di
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.
show more ...
|
| #
12d06e83 |
| 20-Oct-2013 |
Andreas Gohr <andi@splitbrain.org> |
Merge pull request #388 from splitbrain/unittest_errorreporting
set error level so it is propagated correctly to dokuwiki
|
| #
03a4f627 |
| 20-Oct-2013 |
Christopher Smith <chris@jalakai.co.uk> |
change error level to ignore notices
|
| #
9aac3abf |
| 18-Oct-2013 |
Christopher Smith <chris@jalakai.co.uk> |
also use DOKU_E_LEVEL in bootstrap's call to error_reporting()
|
| #
eb9dc169 |
| 18-Oct-2013 |
Christopher Smith <chris@jalakai.co.uk> |
set error level so it is propagated correctly to dokuwiki
|
| #
4e2ac2e4 |
| 18-Oct-2013 |
Christopher Smith <chris@jalakai.co.uk> |
add missing $_SERVER values for init.php when called from cli
|
| #
7840324d |
| 06-Oct-2012 |
Andreas Gohr <andi@splitbrain.org> |
enabled authplain plugin for testsuite
|
| #
0c313f78 |
| 01-Oct-2012 |
Michael Hamann <michael@content-space.de> |
Always load the parser in the test environment
This fixes the problem that $PARSER_MODES was sometimes unset by PHPUnit between test functions that called p_get_parsermodes() as PHPUnit tried to res
Always load the parser in the test environment
This fixes the problem that $PARSER_MODES was sometimes unset by PHPUnit between test functions that called p_get_parsermodes() as PHPUnit tried to restore the global environment. I couldn't reproduce this when I executed all tests but just when I executed a single plugin test.
show more ...
|
| #
0644090a |
| 01-Jul-2012 |
Andreas Gohr <andi@splitbrain.org> |
reset the data directory before each test class is run
|
| #
9c6354e5 |
| 18-Apr-2012 |
Tobias Sarnowski <tobias@trustedco.de> |
use original conf directory and only shadow special files
https://github.com/splitbrain/dokuwiki/pull/96#issuecomment-5195756
|
| #
f8369d7d |
| 18-Apr-2012 |
Tobias Sarnowski <sarnowski@cosmocode.de> |
moved _testing to _test
|