Skip to content

Commit

Permalink
Merge pull request #803 from fredemmott/v2.4.2-derace-testExpiresAsSt…
Browse files Browse the repository at this point in the history
…ring

Fix race condition in testExpiresAsString
  • Loading branch information
Josh Lockhart committed Apr 4, 2014
2 parents 0505f97 + b86f117 commit b2d05e0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/SlimTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -805,15 +805,19 @@ public function testExpiresAsString()
'SCRIPT_NAME' => '/foo', //<-- Physical
'PATH_INFO' => '/bar', //<-- Virtual
));
$expectedDate = gmdate('D, d M Y H:i:s T', strtotime('5 days'));
$s = new \Slim\Slim();
$s->get('/bar', function () use ($s) {
$s->expires('5 days');
});
$s->call();
list($status, $header, $body) = $s->response()->finalize();
$this->assertTrue(isset($header['Expires']));
$this->assertEquals($header['Expires'], $expectedDate);

$this->assertEquals(
strtotime('5 days'),
strtotime($header['Expires']),
1 // delta
);
}

/**
Expand Down

0 comments on commit b2d05e0

Please sign in to comment.