$response = new Response();
$response = explode("\r\n", $response);
$this->assertEquals('HTTP/1.0 200 OK', $response[0]);
- $this->assertEquals('Cache-Control: no-cache', $response[1]);
+ $this->assertEquals('Cache-Control: no-cache, private', $response[1]);
}
public function testClone()
}
}
+ public function testNoDeprecationsAreTriggered()
+ {
+ new DefaultResponse();
+ $this->getMockBuilder(Response::class)->getMock();
+
+ // we just need to ensure that subclasses of Response can be created without any deprecations
+ // being triggered if the subclass does not override any final methods
+ $this->addToAssertionCount(1);
+ }
+
+ /**
+ * @group legacy
+ * @expectedDeprecation Extending Symfony\Component\HttpFoundation\Response::getDate() in Symfony\Component\HttpFoundation\Tests\ExtendedResponse is deprecated %s.
+ * @expectedDeprecation Extending Symfony\Component\HttpFoundation\Response::setLastModified() in Symfony\Component\HttpFoundation\Tests\ExtendedResponse is deprecated %s.
+ */
+ public function testDeprecations()
+ {
+ new ExtendedResponse();
+
+ // Deprecations should not be triggered twice
+ new ExtendedResponse();
+ }
+
public function validContentProvider()
{
return array(
return 'Foo';
}
}
+
+class DefaultResponse extends Response
+{
+}
+
+class ExtendedResponse extends Response
+{
+ public function setLastModified(\DateTime $date = null)
+ {
+ }
+
+ public function getDate()
+ {
+ }
+}