MDL-79247 forum: Workaround same-time discussion modified dates bug
commitf284cd9eaf49600b2eefe2d85d752f8bfc73307b
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Sun, 1 Oct 2023 21:23:30 +0000 (1 23:23 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Sun, 1 Oct 2023 21:23:30 +0000 (1 23:23 +0200)
treea22c825dac2e09f0ac0b30a2568c2395d3facb9c
parent4fcb52cd45cb03398e821e73dd85c2df19c4a6c6
MDL-79247 forum: Workaround same-time discussion modified dates bug

Within the forum_get_discussion_neighbours() function of forum
when the discussions timemodified (last post) is the same, there
is a bug that does strange things when calculating the prev and
next discussions.

Note that, in real life, this is really hard to achieve, but in tests,
when multiple discussions and post can be created by generators in the
same second (specially when the test machine is quick), chances of
facing that problem are higher.

By adding 1 second wait, we ensure that the discussions won't have
the same timemodified (last post) and workaround the problem.

No mater of that, the problem deserves an issue to be created
so we guarantee from code that it also works ok when the same
timemodified (last post) situation happens.
mod/forum/tests/behat/discussion_navigation.feature