Skip to content

Commit

Permalink
Fix media changelog test that did not expect delayed changelog entry
Browse files Browse the repository at this point in the history
What happened was that in the place of the new `waitForTick`-call an
actual delay happened and therefore the file modification time and the
deletion entry were two different points in time, resulting in random
test failures. The test enforces this now, the condition to test has
been adjusted.
  • Loading branch information
michitux committed Jan 1, 2017
1 parent 7e95efe commit 7f48c40
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion _test/tests/inc/changelog_getlastrevisionat.test.php
Expand Up @@ -150,11 +150,16 @@ function test_deletedimage() {
$revexpected = @filemtime(mediaFn($image));
$rev = $revexpected + 10;

$this->waitForTick(true);

$ret = media_delete($image, 0);

$medialog = new MediaChangelog($image);
$current = $medialog->getLastRevisionAt($rev);
$this->assertEquals($revexpected, $current);
// as we wait for a tick, we should get something greater than the timestamp
$this->assertGreaterThan($revexpected, $current);
// however, it should be less than the current time or equal to it
$this->assertLessThanOrEqual(time(), $current);

//restore settings
$_SERVER['REMOTE_USER'] = $oldRemoteUser;
Expand Down

0 comments on commit 7f48c40

Please sign in to comment.