History log of /dokuwiki/_test/tests/inc/common_saveWikiText.test.php (Results 1 – 19 of 19)
Revision Date Author Comments
# 01e8d739 25-Apr-2026 Andreas Gohr <andi@splitbrain.org>

refactor(changelog): persist external-edit detection on first read

This addresses the flaky test that makes tests randomly fail (mostly on
windows runners).

The flake in common_saveWikiText_test::t

refactor(changelog): persist external-edit detection on first read

This addresses the flaky test that makes tests randomly fail (mostly on
windows runners).

The flake in common_saveWikiText_test::test_savesequence5 came from
this line in ChangeLog::getCurrentRevisionInfo():

'date' => max($lastRev + 1, time() - 1)

The synthesized "external delete" entry was kept in memory only and
only persisted later, when saveWikiText next called detectExternalEdit.
That meant the formula was evaluated twice on different ChangeLog
instances — once during the test's inspection, and again during the
following saveWikiText — and the two evaluations could pick different
seconds depending on how long the surrounding I/O took. The test
cached the first result in $expectExternal and asserted it against the
on-disk entry written during the second call. On the slower Windows
runner the second call sometimes crossed a second boundary, producing
the off-by-one date mismatch.

The questions I had was, why are we persisting external file deletions
(or edits) only when a page is saved when we are obviously already
detecting it earlier during the changelog read already?

Instead of recording the external delete at the time a new page is
written, it makes sense to record it as soon as we detect it (when the
changelog is requested by a user or a bot). This will make the recoded
timestamp closer to the actual deletion.

This patch refactors the changelog accordingly, but still tries to be
minimal invasive (I think the changelog handling would need much more
refactoring, but that's beyond the scope of this change).

To enable proper locking (when logging an external edit and copying
the attic file), locking had to be moved to the Changelog class,
duplicating some code of io_saveFile.

PageFile::detectExternalEdit() and the deprecated procedural wrapper
detectExternalEdit() in inc/common.php are removed. A codesearch.dokuwiki.org
check confirmed no plugin calls the method directly; the only external
caller of the procedural function is the farmsync plugin, which needs
a parallel update.

show more ...


# 36784b8f 27-Nov-2024 Andreas Gohr <andi@splitbrain.org>

use new expectLogMessage to check condition tested in test_savesequence4()


# 9ad2b913 25-Nov-2024 Andreas Gohr <andi@splitbrain.org>

replace deprecated phpunit assertions


# 5e23cdb8 29-Nov-2021 Satoshi Sahara <sahara.satoshi@gmail.com>

Update common_saveWikiText.test.php

allow 2nd to last revision check for normal save


# b7b9a99d 28-Nov-2021 Satoshi Sahara <sahara.satoshi@gmail.com>

update unittest checkChangeLogAfterNormalSave

add routine for "save on top of external edit" assertions


# 8fb3ff96 27-Nov-2021 Satoshi Sahara <sahara.satoshi@gmail.com>

saveWikiText() unittest 5

5.1 create a page
5.2 external edit
5.3 edit and save
5.4 delete
5.5 create a page, second time
5.6 externally delete
5.7 create a page, third time


# e21f9472 27-Nov-2021 Satoshi Sahara <sahara.satoshi@gmail.com>

saveWikiText() unittest 3.3

second to last revision check after repeated external edit


# 92fda7f4 27-Nov-2021 Satoshi Sahara <sahara.satoshi@gmail.com>

saveWikiText() unittest 4

4.1 externally create a page
4.2 edit and save
4.3 externally edit (file older than last rev)


# 3c425c43 24-Nov-2021 Satoshi Sahara <sahara.satoshi@gmail.com>

group assertions for saveWikiText()


# df60c5f9 06-Nov-2021 Satoshi Sahara <sahara.satoshi@gmail.com>

Update common_saveWikiText.test.php

getRevisions() may return empty array when changelog file does not yet exist.


# 3d3f6056 06-Nov-2021 Satoshi Sahara <sahara.satoshi@gmail.com>

rewrite unit test of saveWikiText


# 7866d571 24-Oct-2021 Satoshi Sahara <sahara.satoshi@gmail.com>

UnitTest of pageinfo(), saveWikiText()

ChangeLog creates early .change file, p_get_metadata() will get full "meta_last_change" entry. The current key in the revinfo need to be excluded prior to p_s

UnitTest of pageinfo(), saveWikiText()

ChangeLog creates early .change file, p_get_metadata() will get full "meta_last_change" entry. The current key in the revinfo need to be excluded prior to p_set_metadata() call.

show more ...


# e1d9dcc8 15-Jun-2018 Andreas Gohr <andi@splitbrain.org>

First go at moving the plugin classes into their own namespace


# 0c3a5702 15-Jun-2018 Andreas Gohr <andi@splitbrain.org>

split changelog classes into their own namespace

The remaining functions in inc/changelog.php should be moved into a
utility class.


# ea466a98 01-Jan-2017 Michael Hamann <michael@content-space.de>

Added more testing to ensure correct handling of delayed writes


# aaf4f55e 01-Dec-2016 Andreas Gohr <gohr@cosmocode.de>

use waitForTick in all our tests


# 6072486d 19-Mar-2016 Gerrit Uitslag <klapinklapin@gmail.com>

bunch of tests for saveWikiText


# 4b5aebc1 18-Mar-2016 Gerrit Uitslag <klapinklapin@gmail.com>

filesize zero cases, compressed revisions

- handle all cases where not an old file exist, or when that old file is
zero size.
- When using old revision normally these files are compressed, use
uncom

filesize zero cases, compressed revisions

- handle all cases where not an old file exist, or when that old file is
zero size.
- When using old revision normally these files are compressed, use
uncompressed size.

show more ...


# 023953f0 17-Feb-2016 Andreas Gohr <gohr@cosmocode.de>

added test for saveWikiTest()

for possible upcoming refactoring