Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions tests/wiki/edit_lock_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,17 @@ public function test_after_switching_to_the_lock_the_first_editor_keeps_the_arti
public function test_taking_again_keeps_when_the_editor_started()
{
$lock = $this->lock();
// Read the clock once: a second can pass before the checks on a slow runner
$started = time() - 600;
$old_expiry = time() + 60;
$this->db->sql_query('INSERT INTO phpbb_wiki_edit_lock ' . $this->db->sql_build_array('INSERT', array(
'article_url' => 'Main Page', 'user_id' => 2, 'lock_time' => time() - 600, 'lock_expires' => time() + 60, 'blocked_notified' => 0,
'article_url' => 'Main Page', 'user_id' => 2, 'lock_time' => $started, 'lock_expires' => $old_expiry, 'blocked_notified' => 0,
)));
$lock->take('Main Page', 2);

$others = $lock->others('Main Page', 3);
$this->assertSame(time() - 600, (int) $others[0]['lock_time'], 'the start time is kept', 2);
$this->assertGreaterThan(time() + 60, (int) $others[0]['lock_expires']);
$this->assertSame($started, (int) $others[0]['lock_time'], 'the start time is kept');
$this->assertGreaterThan($old_expiry, (int) $others[0]['lock_expires']);
}

public function test_a_record_that_ran_out_keeps_nobody_out_and_is_cleared()
Expand Down
Loading