minor #11966 [HttpFoundation] fixed some volatile tests (fabpot)
This PR was merged into the 2.3 branch. Discussion ---------- [HttpFoundation] fixed some volatile tests | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | see #11588 | License | MIT | Doc PR | n/a Commits -------00c1b75
[Process] fixed some volatile tests974bf01
[HttpKernel] fixed a volatile test6020c43
[HttpFoundation] fixed some volatile tests
This commit is contained in:
commit
f5d4515200
@ -132,8 +132,9 @@ class ResponseTest extends ResponseTestCase
|
|||||||
|
|
||||||
public function testGetDate()
|
public function testGetDate()
|
||||||
{
|
{
|
||||||
$response = new Response('', 200, array('Date' => $this->createDateTimeOneHourAgo()->format(DATE_RFC2822)));
|
$oneHourAgo = $this->createDateTimeOneHourAgo();
|
||||||
$this->assertEquals(0, $this->createDateTimeOneHourAgo()->diff($response->getDate())->format('%s'), '->getDate() returns the Date header if present');
|
$response = new Response('', 200, array('Date' => $oneHourAgo->format(DATE_RFC2822)));
|
||||||
|
$this->assertEquals(0, $oneHourAgo->diff($response->getDate())->format('%s'), '->getDate() returns the Date header if present');
|
||||||
|
|
||||||
$response = new Response();
|
$response = new Response();
|
||||||
$date = $response->getDate();
|
$date = $response->getDate();
|
||||||
@ -142,7 +143,7 @@ class ResponseTest extends ResponseTestCase
|
|||||||
$response = new Response('', 200, array('Date' => $this->createDateTimeOneHourAgo()->format(DATE_RFC2822)));
|
$response = new Response('', 200, array('Date' => $this->createDateTimeOneHourAgo()->format(DATE_RFC2822)));
|
||||||
$now = $this->createDateTimeNow();
|
$now = $this->createDateTimeNow();
|
||||||
$response->headers->set('Date', $now->format(DATE_RFC2822));
|
$response->headers->set('Date', $now->format(DATE_RFC2822));
|
||||||
$this->assertEquals(0, $now->diff($response->getDate())->format('%s'), '->getDate() returns the date when the header has been modified');
|
$this->assertLessThanOrEqual(1, $now->diff($response->getDate())->format('%s'), '->getDate() returns the date when the header has been modified');
|
||||||
|
|
||||||
$response = new Response('', 200);
|
$response = new Response('', 200);
|
||||||
$response->headers->remove('Date');
|
$response->headers->remove('Date');
|
||||||
@ -162,7 +163,7 @@ class ResponseTest extends ResponseTestCase
|
|||||||
$response = new Response();
|
$response = new Response();
|
||||||
$response->headers->set('Cache-Control', 'must-revalidate');
|
$response->headers->set('Cache-Control', 'must-revalidate');
|
||||||
$response->headers->set('Expires', $this->createDateTimeOneHourLater()->format(DATE_RFC2822));
|
$response->headers->set('Expires', $this->createDateTimeOneHourLater()->format(DATE_RFC2822));
|
||||||
$this->assertEquals(3600, $response->getMaxAge(), '->getMaxAge() falls back to Expires when no max-age or s-maxage directive present');
|
$this->assertLessThanOrEqual(1, $response->getMaxAge() - 3600, '->getMaxAge() falls back to Expires when no max-age or s-maxage directive present');
|
||||||
|
|
||||||
$response = new Response();
|
$response = new Response();
|
||||||
$response->headers->set('Cache-Control', 'must-revalidate');
|
$response->headers->set('Cache-Control', 'must-revalidate');
|
||||||
@ -233,7 +234,7 @@ class ResponseTest extends ResponseTestCase
|
|||||||
|
|
||||||
$response = new Response();
|
$response = new Response();
|
||||||
$response->headers->set('Expires', $this->createDateTimeOneHourLater()->format(DATE_RFC2822));
|
$response->headers->set('Expires', $this->createDateTimeOneHourLater()->format(DATE_RFC2822));
|
||||||
$this->assertLessThan(1, 3600 - $response->getTtl(), '->getTtl() uses the Expires header when no max-age is present');
|
$this->assertLessThanOrEqual(1, 3600 - $response->getTtl(), '->getTtl() uses the Expires header when no max-age is present');
|
||||||
|
|
||||||
$response = new Response();
|
$response = new Response();
|
||||||
$response->headers->set('Expires', $this->createDateTimeOneHourAgo()->format(DATE_RFC2822));
|
$response->headers->set('Expires', $this->createDateTimeOneHourAgo()->format(DATE_RFC2822));
|
||||||
|
@ -606,7 +606,7 @@ class HttpCacheTest extends HttpCacheTestCase
|
|||||||
$this->assertTraceContains('miss');
|
$this->assertTraceContains('miss');
|
||||||
$this->assertTraceContains('store');
|
$this->assertTraceContains('store');
|
||||||
$this->assertEquals('Hello World', $this->response->getContent());
|
$this->assertEquals('Hello World', $this->response->getContent());
|
||||||
$this->assertRegExp('/s-maxage=2/', $this->response->headers->get('Cache-Control'));
|
$this->assertRegExp('/s-maxage=(?:2|3)/', $this->response->headers->get('Cache-Control'));
|
||||||
|
|
||||||
$this->request('GET', '/');
|
$this->request('GET', '/');
|
||||||
$this->assertHttpKernelIsNotCalled();
|
$this->assertHttpKernelIsNotCalled();
|
||||||
|
@ -77,9 +77,8 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
|||||||
while ($p->isRunning()) {
|
while ($p->isRunning()) {
|
||||||
usleep(1000);
|
usleep(1000);
|
||||||
}
|
}
|
||||||
$duration = microtime(true) - $start;
|
|
||||||
|
|
||||||
$this->assertLessThan(1.8, $duration);
|
$this->assertLessThan(4, microtime(true) - $start);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAllOutputIsActuallyReadOnTermination()
|
public function testAllOutputIsActuallyReadOnTermination()
|
||||||
@ -396,7 +395,7 @@ abstract class AbstractProcessTest extends \PHPUnit_Framework_TestCase
|
|||||||
$start = microtime(true);
|
$start = microtime(true);
|
||||||
$process->start();
|
$process->start();
|
||||||
$end = microtime(true);
|
$end = microtime(true);
|
||||||
$this->assertLessThan(0.2, $end-$start);
|
$this->assertLessThan(1, $end - $start);
|
||||||
$process->wait();
|
$process->wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user