Merge branch '4.4' into 5.1
This commit is contained in:
commit
1c6380f333
19
.travis.yml
19
.travis.yml
@ -123,23 +123,6 @@ before_install:
|
|||||||
}
|
}
|
||||||
export -f tpecl
|
export -f tpecl
|
||||||
|
|
||||||
install_apcu_dev () {
|
|
||||||
local ref=$1
|
|
||||||
local INI=$2
|
|
||||||
|
|
||||||
wget https://github.com/krakjoe/apcu/archive/${ref}.zip
|
|
||||||
unzip ${ref}.zip
|
|
||||||
cd apcu-${ref}
|
|
||||||
phpize
|
|
||||||
./configure
|
|
||||||
make
|
|
||||||
mv modules/apcu.so $(php -r "echo ini_get('extension_dir');")
|
|
||||||
echo 'extension = apcu.so' >> $INI
|
|
||||||
cd ..
|
|
||||||
rm -rf apcu-${ref} ${ref}.zip
|
|
||||||
}
|
|
||||||
export -f install_apcu_dev
|
|
||||||
|
|
||||||
- |
|
- |
|
||||||
# Install sigchild-enabled PHP to test the Process component on the lowest PHP matrix line
|
# Install sigchild-enabled PHP to test the Process component on the lowest PHP matrix line
|
||||||
if [[ ! $deps && $TRAVIS_PHP_VERSION = ${MIN_PHP%.*} && ! -d php-$MIN_PHP/sapi ]]; then
|
if [[ ! $deps && $TRAVIS_PHP_VERSION = ${MIN_PHP%.*} && ! -d php-$MIN_PHP/sapi ]]; then
|
||||||
@ -176,7 +159,7 @@ before_install:
|
|||||||
tfold ext.memcached tpecl memcached-3.1.5 memcached.so $INI
|
tfold ext.memcached tpecl memcached-3.1.5 memcached.so $INI
|
||||||
tfold ext.apcu install_apcu_dev 9c36db45100d4d27ec33072f4be90f1f5a0108b7 $INI
|
tfold ext.apcu install_apcu_dev 9c36db45100d4d27ec33072f4be90f1f5a0108b7 $INI
|
||||||
else
|
else
|
||||||
tfold ext.apcu tpecl apcu-5.1.18 apcu.so $INI
|
tfold ext.apcu tpecl apcu-5.1.19 apcu.so $INI
|
||||||
tfold ext.mongodb tpecl mongodb-1.6.16 mongodb.so $INI
|
tfold ext.mongodb tpecl mongodb-1.6.16 mongodb.so $INI
|
||||||
tfold ext.zookeeper tpecl zookeeper-0.7.2 zookeeper.so $INI
|
tfold ext.zookeeper tpecl zookeeper-0.7.2 zookeeper.so $INI
|
||||||
tfold ext.amqp tpecl amqp-1.10.2 amqp.so $INI
|
tfold ext.amqp tpecl amqp-1.10.2 amqp.so $INI
|
||||||
|
@ -95,19 +95,10 @@ class DoctrineExtractor implements PropertyListExtractorInterface, PropertyTypeE
|
|||||||
$associationMapping = $metadata->getAssociationMapping($property);
|
$associationMapping = $metadata->getAssociationMapping($property);
|
||||||
|
|
||||||
if (isset($associationMapping['indexBy'])) {
|
if (isset($associationMapping['indexBy'])) {
|
||||||
$indexProperty = $associationMapping['indexBy'];
|
$indexColumn = $associationMapping['indexBy'];
|
||||||
/** @var ClassMetadataInfo $subMetadata */
|
/** @var ClassMetadataInfo $subMetadata */
|
||||||
$subMetadata = $this->entityManager ? $this->entityManager->getClassMetadata($associationMapping['targetEntity']) : $this->classMetadataFactory->getMetadataFor($associationMapping['targetEntity']);
|
$subMetadata = $this->entityManager ? $this->entityManager->getClassMetadata($associationMapping['targetEntity']) : $this->classMetadataFactory->getMetadataFor($associationMapping['targetEntity']);
|
||||||
$typeOfField = $subMetadata->getTypeOfField($indexProperty);
|
$typeOfField = $subMetadata->getTypeOfField($subMetadata->getFieldForColumn($indexColumn));
|
||||||
|
|
||||||
if (null === $typeOfField) {
|
|
||||||
$associationMapping = $subMetadata->getAssociationMapping($indexProperty);
|
|
||||||
|
|
||||||
/** @var ClassMetadataInfo $subMetadata */
|
|
||||||
$indexProperty = $subMetadata->getSingleAssociationReferencedJoinColumnName($indexProperty);
|
|
||||||
$subMetadata = $this->entityManager ? $this->entityManager->getClassMetadata($associationMapping['targetEntity']) : $this->classMetadataFactory->getMetadataFor($associationMapping['targetEntity']);
|
|
||||||
$typeOfField = $subMetadata->getTypeOfField($indexProperty);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$collectionKeyType = $this->getPhpType($typeOfField)) {
|
if (!$collectionKeyType = $this->getPhpType($typeOfField)) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -60,13 +60,6 @@ class EntityTypeTest extends BaseTypeTest
|
|||||||
|
|
||||||
protected static $supportedFeatureSetVersion = 404;
|
protected static $supportedFeatureSetVersion = 404;
|
||||||
|
|
||||||
public static function setUpBeforeClass(): void
|
|
||||||
{
|
|
||||||
if (\PHP_VERSION_ID >= 80000) {
|
|
||||||
self::markTestSkipped('Doctrine DBAL 2.x is incompatible with PHP 8.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
$this->em = DoctrineTestHelper::createTestEntityManager();
|
$this->em = DoctrineTestHelper::createTestEntityManager();
|
||||||
|
@ -42,7 +42,7 @@ class DoctrineDummy
|
|||||||
public $bar;
|
public $bar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ManyToMany(targetEntity="DoctrineRelation", indexBy="rguid")
|
* @ManyToMany(targetEntity="DoctrineRelation", indexBy="rguid_column")
|
||||||
*/
|
*/
|
||||||
protected $indexedBar;
|
protected $indexedBar;
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ class DoctrineRelation
|
|||||||
public $id;
|
public $id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Column(type="guid")
|
* @Column(type="guid", name="rguid_column")
|
||||||
*/
|
*/
|
||||||
protected $rguid;
|
protected $rguid;
|
||||||
|
|
||||||
|
@ -13,13 +13,6 @@ use Symfony\Component\Security\Core\Exception\TokenNotFoundException;
|
|||||||
*/
|
*/
|
||||||
class DoctrineTokenProviderTest extends TestCase
|
class DoctrineTokenProviderTest extends TestCase
|
||||||
{
|
{
|
||||||
public static function setUpBeforeClass(): void
|
|
||||||
{
|
|
||||||
if (\PHP_VERSION_ID >= 80000) {
|
|
||||||
self::markTestSkipped('Doctrine DBAL 2.x is incompatible with PHP 8.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testCreateNewToken()
|
public function testCreateNewToken()
|
||||||
{
|
{
|
||||||
$provider = $this->bootstrapProvider();
|
$provider = $this->bootstrapProvider();
|
||||||
|
@ -24,13 +24,6 @@ use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
|
|||||||
|
|
||||||
class EntityUserProviderTest extends TestCase
|
class EntityUserProviderTest extends TestCase
|
||||||
{
|
{
|
||||||
public static function setUpBeforeClass(): void
|
|
||||||
{
|
|
||||||
if (\PHP_VERSION_ID >= 80000) {
|
|
||||||
self::markTestSkipped('Doctrine DBAL 2.x is incompatible with PHP 8.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testRefreshUserGetsUserByPrimaryKey()
|
public function testRefreshUserGetsUserByPrimaryKey()
|
||||||
{
|
{
|
||||||
$em = DoctrineTestHelper::createTestEntityManager();
|
$em = DoctrineTestHelper::createTestEntityManager();
|
||||||
|
@ -59,13 +59,6 @@ class UniqueEntityValidatorTest extends ConstraintValidatorTestCase
|
|||||||
|
|
||||||
protected $repositoryFactory;
|
protected $repositoryFactory;
|
||||||
|
|
||||||
public static function setUpBeforeClass(): void
|
|
||||||
{
|
|
||||||
if (\PHP_VERSION_ID >= 80000) {
|
|
||||||
self::markTestSkipped('Doctrine DBAL 2.x is incompatible with PHP 8.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
$this->repositoryFactory = new TestRepositoryFactory();
|
$this->repositoryFactory = new TestRepositoryFactory();
|
||||||
|
@ -541,6 +541,6 @@ div.sf-toolbar .sf-toolbar-block a:hover {
|
|||||||
/***** Media query print: Do not print the Toolbar. *****/
|
/***** Media query print: Do not print the Toolbar. *****/
|
||||||
@media print {
|
@media print {
|
||||||
.sf-toolbar {
|
.sf-toolbar {
|
||||||
display: none;
|
display: none !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ class AbstractBrowserTest extends TestCase
|
|||||||
{
|
{
|
||||||
$client = $this->getBrowser();
|
$client = $this->getBrowser();
|
||||||
$client->xmlHttpRequest('GET', 'http://example.com/', [], [], [], null, true);
|
$client->xmlHttpRequest('GET', 'http://example.com/', [], [], [], null, true);
|
||||||
$this->assertEquals($client->getRequest()->getServer()['HTTP_X_REQUESTED_WITH'], 'XMLHttpRequest');
|
$this->assertSame('XMLHttpRequest', $client->getRequest()->getServer()['HTTP_X_REQUESTED_WITH']);
|
||||||
$this->assertFalse($client->getServerParameter('HTTP_X_REQUESTED_WITH', false));
|
$this->assertFalse($client->getServerParameter('HTTP_X_REQUESTED_WITH', false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,9 +65,9 @@ class AbstractBrowserTest extends TestCase
|
|||||||
$client = $this->getBrowser();
|
$client = $this->getBrowser();
|
||||||
$client->request('GET', 'https://example.com/foo', [], [], ['HTTP_HOST' => '127.0.0.1']);
|
$client->request('GET', 'https://example.com/foo', [], [], ['HTTP_HOST' => '127.0.0.1']);
|
||||||
|
|
||||||
$this->assertEquals('https://example.com/foo', $client->getRequest()->getUri());
|
$this->assertSame('https://example.com/foo', $client->getRequest()->getUri());
|
||||||
$headers = $client->getRequest()->getServer();
|
$headers = $client->getRequest()->getServer();
|
||||||
$this->assertEquals('127.0.0.1', $headers['HTTP_HOST']);
|
$this->assertSame('127.0.0.1', $headers['HTTP_HOST']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetResponse()
|
public function testGetResponse()
|
||||||
@ -76,7 +76,7 @@ class AbstractBrowserTest extends TestCase
|
|||||||
$client->setNextResponse(new Response('foo'));
|
$client->setNextResponse(new Response('foo'));
|
||||||
$client->request('GET', 'http://example.com/');
|
$client->request('GET', 'http://example.com/');
|
||||||
|
|
||||||
$this->assertEquals('foo', $client->getResponse()->getContent(), '->getCrawler() returns the Response of the last request');
|
$this->assertSame('foo', $client->getResponse()->getContent(), '->getCrawler() returns the Response of the last request');
|
||||||
$this->assertInstanceOf('Symfony\Component\BrowserKit\Response', $client->getResponse(), '->getCrawler() returns the Response of the last request');
|
$this->assertInstanceOf('Symfony\Component\BrowserKit\Response', $client->getResponse(), '->getCrawler() returns the Response of the last request');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ class AbstractBrowserTest extends TestCase
|
|||||||
|
|
||||||
$client = $this->getBrowser();
|
$client = $this->getBrowser();
|
||||||
$client->request('POST', 'http://example.com/jsonrpc', [], [], [], $json);
|
$client->request('POST', 'http://example.com/jsonrpc', [], [], [], $json);
|
||||||
$this->assertEquals($json, $client->getRequest()->getContent());
|
$this->assertSame($json, $client->getRequest()->getContent());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetCrawler()
|
public function testGetCrawler()
|
||||||
@ -130,12 +130,12 @@ class AbstractBrowserTest extends TestCase
|
|||||||
$client = $this->getBrowser();
|
$client = $this->getBrowser();
|
||||||
$client->request('GET', '/');
|
$client->request('GET', '/');
|
||||||
$headers = $client->getRequest()->getServer();
|
$headers = $client->getRequest()->getServer();
|
||||||
$this->assertEquals('localhost', $headers['HTTP_HOST'], '->request() sets the HTTP_HOST header');
|
$this->assertSame('localhost', $headers['HTTP_HOST'], '->request() sets the HTTP_HOST header');
|
||||||
|
|
||||||
$client = $this->getBrowser();
|
$client = $this->getBrowser();
|
||||||
$client->request('GET', 'http://www.example.com');
|
$client->request('GET', 'http://www.example.com');
|
||||||
$headers = $client->getRequest()->getServer();
|
$headers = $client->getRequest()->getServer();
|
||||||
$this->assertEquals('www.example.com', $headers['HTTP_HOST'], '->request() sets the HTTP_HOST header');
|
$this->assertSame('www.example.com', $headers['HTTP_HOST'], '->request() sets the HTTP_HOST header');
|
||||||
|
|
||||||
$client->request('GET', 'https://www.example.com');
|
$client->request('GET', 'https://www.example.com');
|
||||||
$headers = $client->getRequest()->getServer();
|
$headers = $client->getRequest()->getServer();
|
||||||
@ -144,66 +144,66 @@ class AbstractBrowserTest extends TestCase
|
|||||||
$client = $this->getBrowser();
|
$client = $this->getBrowser();
|
||||||
$client->request('GET', 'http://www.example.com:8080');
|
$client->request('GET', 'http://www.example.com:8080');
|
||||||
$headers = $client->getRequest()->getServer();
|
$headers = $client->getRequest()->getServer();
|
||||||
$this->assertEquals('www.example.com:8080', $headers['HTTP_HOST'], '->request() sets the HTTP_HOST header with port');
|
$this->assertSame('www.example.com:8080', $headers['HTTP_HOST'], '->request() sets the HTTP_HOST header with port');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRequestURIConversion()
|
public function testRequestURIConversion()
|
||||||
{
|
{
|
||||||
$client = $this->getBrowser();
|
$client = $this->getBrowser();
|
||||||
$client->request('GET', '/foo');
|
$client->request('GET', '/foo');
|
||||||
$this->assertEquals('http://localhost/foo', $client->getRequest()->getUri(), '->request() converts the URI to an absolute one');
|
$this->assertSame('http://localhost/foo', $client->getRequest()->getUri(), '->request() converts the URI to an absolute one');
|
||||||
|
|
||||||
$client = $this->getBrowser();
|
$client = $this->getBrowser();
|
||||||
$client->request('GET', 'http://www.example.com');
|
$client->request('GET', 'http://www.example.com');
|
||||||
$this->assertEquals('http://www.example.com', $client->getRequest()->getUri(), '->request() does not change absolute URIs');
|
$this->assertSame('http://www.example.com', $client->getRequest()->getUri(), '->request() does not change absolute URIs');
|
||||||
|
|
||||||
$client = $this->getBrowser();
|
$client = $this->getBrowser();
|
||||||
$client->request('GET', 'http://www.example.com/');
|
$client->request('GET', 'http://www.example.com/');
|
||||||
$client->request('GET', '/foo');
|
$client->request('GET', '/foo');
|
||||||
$this->assertEquals('http://www.example.com/foo', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
|
$this->assertSame('http://www.example.com/foo', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
|
||||||
|
|
||||||
$client = $this->getBrowser();
|
$client = $this->getBrowser();
|
||||||
$client->request('GET', 'http://www.example.com/foo');
|
$client->request('GET', 'http://www.example.com/foo');
|
||||||
$client->request('GET', '#');
|
$client->request('GET', '#');
|
||||||
$this->assertEquals('http://www.example.com/foo#', $client->getRequest()->getUri(), '->request() uses the previous request for #');
|
$this->assertSame('http://www.example.com/foo#', $client->getRequest()->getUri(), '->request() uses the previous request for #');
|
||||||
$client->request('GET', '#');
|
$client->request('GET', '#');
|
||||||
$this->assertEquals('http://www.example.com/foo#', $client->getRequest()->getUri(), '->request() uses the previous request for #');
|
$this->assertSame('http://www.example.com/foo#', $client->getRequest()->getUri(), '->request() uses the previous request for #');
|
||||||
$client->request('GET', '#foo');
|
$client->request('GET', '#foo');
|
||||||
$this->assertEquals('http://www.example.com/foo#foo', $client->getRequest()->getUri(), '->request() uses the previous request for #');
|
$this->assertSame('http://www.example.com/foo#foo', $client->getRequest()->getUri(), '->request() uses the previous request for #');
|
||||||
|
|
||||||
$client = $this->getBrowser();
|
$client = $this->getBrowser();
|
||||||
$client->request('GET', 'http://www.example.com/foo/');
|
$client->request('GET', 'http://www.example.com/foo/');
|
||||||
$client->request('GET', 'bar');
|
$client->request('GET', 'bar');
|
||||||
$this->assertEquals('http://www.example.com/foo/bar', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
|
$this->assertSame('http://www.example.com/foo/bar', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
|
||||||
|
|
||||||
$client = $this->getBrowser();
|
$client = $this->getBrowser();
|
||||||
$client->request('GET', 'http://www.example.com/foo/foobar');
|
$client->request('GET', 'http://www.example.com/foo/foobar');
|
||||||
$client->request('GET', 'bar');
|
$client->request('GET', 'bar');
|
||||||
$this->assertEquals('http://www.example.com/foo/bar', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
|
$this->assertSame('http://www.example.com/foo/bar', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
|
||||||
|
|
||||||
$client = $this->getBrowser();
|
$client = $this->getBrowser();
|
||||||
$client->request('GET', 'http://www.example.com/foo/');
|
$client->request('GET', 'http://www.example.com/foo/');
|
||||||
$client->request('GET', 'http');
|
$client->request('GET', 'http');
|
||||||
$this->assertEquals('http://www.example.com/foo/http', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
|
$this->assertSame('http://www.example.com/foo/http', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
|
||||||
|
|
||||||
$client = $this->getBrowser();
|
$client = $this->getBrowser();
|
||||||
$client->request('GET', 'http://www.example.com/foo');
|
$client->request('GET', 'http://www.example.com/foo');
|
||||||
$client->request('GET', 'http/bar');
|
$client->request('GET', 'http/bar');
|
||||||
$this->assertEquals('http://www.example.com/http/bar', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
|
$this->assertSame('http://www.example.com/http/bar', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
|
||||||
|
|
||||||
$client = $this->getBrowser();
|
$client = $this->getBrowser();
|
||||||
$client->request('GET', 'http://www.example.com/');
|
$client->request('GET', 'http://www.example.com/');
|
||||||
$client->request('GET', 'http');
|
$client->request('GET', 'http');
|
||||||
$this->assertEquals('http://www.example.com/http', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
|
$this->assertSame('http://www.example.com/http', $client->getRequest()->getUri(), '->request() uses the previous request for relative URLs');
|
||||||
|
|
||||||
$client = $this->getBrowser();
|
$client = $this->getBrowser();
|
||||||
$client->request('GET', 'http://www.example.com/foo');
|
$client->request('GET', 'http://www.example.com/foo');
|
||||||
$client->request('GET', '?');
|
$client->request('GET', '?');
|
||||||
$this->assertEquals('http://www.example.com/foo?', $client->getRequest()->getUri(), '->request() uses the previous request for ?');
|
$this->assertSame('http://www.example.com/foo?', $client->getRequest()->getUri(), '->request() uses the previous request for ?');
|
||||||
$client->request('GET', '?');
|
$client->request('GET', '?');
|
||||||
$this->assertEquals('http://www.example.com/foo?', $client->getRequest()->getUri(), '->request() uses the previous request for ?');
|
$this->assertSame('http://www.example.com/foo?', $client->getRequest()->getUri(), '->request() uses the previous request for ?');
|
||||||
$client->request('GET', '?foo=bar');
|
$client->request('GET', '?foo=bar');
|
||||||
$this->assertEquals('http://www.example.com/foo?foo=bar', $client->getRequest()->getUri(), '->request() uses the previous request for ?');
|
$this->assertSame('http://www.example.com/foo?foo=bar', $client->getRequest()->getUri(), '->request() uses the previous request for ?');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRequestReferer()
|
public function testRequestReferer()
|
||||||
@ -212,7 +212,7 @@ class AbstractBrowserTest extends TestCase
|
|||||||
$client->request('GET', 'http://www.example.com/foo/foobar');
|
$client->request('GET', 'http://www.example.com/foo/foobar');
|
||||||
$client->request('GET', 'bar');
|
$client->request('GET', 'bar');
|
||||||
$server = $client->getRequest()->getServer();
|
$server = $client->getRequest()->getServer();
|
||||||
$this->assertEquals('http://www.example.com/foo/foobar', $server['HTTP_REFERER'], '->request() sets the referer');
|
$this->assertSame('http://www.example.com/foo/foobar', $server['HTTP_REFERER'], '->request() sets the referer');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRequestRefererCanBeOverridden()
|
public function testRequestRefererCanBeOverridden()
|
||||||
@ -221,7 +221,7 @@ class AbstractBrowserTest extends TestCase
|
|||||||
$client->request('GET', 'http://www.example.com/foo/foobar');
|
$client->request('GET', 'http://www.example.com/foo/foobar');
|
||||||
$client->request('GET', 'bar', [], [], ['HTTP_REFERER' => 'xyz']);
|
$client->request('GET', 'bar', [], [], ['HTTP_REFERER' => 'xyz']);
|
||||||
$server = $client->getRequest()->getServer();
|
$server = $client->getRequest()->getServer();
|
||||||
$this->assertEquals('xyz', $server['HTTP_REFERER'], '->request() allows referer to be overridden');
|
$this->assertSame('xyz', $server['HTTP_REFERER'], '->request() allows referer to be overridden');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRequestHistory()
|
public function testRequestHistory()
|
||||||
@ -230,8 +230,8 @@ class AbstractBrowserTest extends TestCase
|
|||||||
$client->request('GET', 'http://www.example.com/foo/foobar');
|
$client->request('GET', 'http://www.example.com/foo/foobar');
|
||||||
$client->request('GET', 'bar');
|
$client->request('GET', 'bar');
|
||||||
|
|
||||||
$this->assertEquals('http://www.example.com/foo/bar', $client->getHistory()->current()->getUri(), '->request() updates the History');
|
$this->assertSame('http://www.example.com/foo/bar', $client->getHistory()->current()->getUri(), '->request() updates the History');
|
||||||
$this->assertEquals('http://www.example.com/foo/foobar', $client->getHistory()->back()->getUri(), '->request() updates the History');
|
$this->assertSame('http://www.example.com/foo/foobar', $client->getHistory()->back()->getUri(), '->request() updates the History');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRequestCookies()
|
public function testRequestCookies()
|
||||||
@ -239,10 +239,10 @@ class AbstractBrowserTest extends TestCase
|
|||||||
$client = $this->getBrowser();
|
$client = $this->getBrowser();
|
||||||
$client->setNextResponse(new Response('<html><a href="/foo">foo</a></html>', 200, ['Set-Cookie' => 'foo=bar']));
|
$client->setNextResponse(new Response('<html><a href="/foo">foo</a></html>', 200, ['Set-Cookie' => 'foo=bar']));
|
||||||
$client->request('GET', 'http://www.example.com/foo/foobar');
|
$client->request('GET', 'http://www.example.com/foo/foobar');
|
||||||
$this->assertEquals(['foo' => 'bar'], $client->getCookieJar()->allValues('http://www.example.com/foo/foobar'), '->request() updates the CookieJar');
|
$this->assertSame(['foo' => 'bar'], $client->getCookieJar()->allValues('http://www.example.com/foo/foobar'), '->request() updates the CookieJar');
|
||||||
|
|
||||||
$client->request('GET', 'bar');
|
$client->request('GET', 'bar');
|
||||||
$this->assertEquals(['foo' => 'bar'], $client->getCookieJar()->allValues('http://www.example.com/foo/foobar'), '->request() updates the CookieJar');
|
$this->assertSame(['foo' => 'bar'], $client->getCookieJar()->allValues('http://www.example.com/foo/foobar'), '->request() updates the CookieJar');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRequestSecureCookies()
|
public function testRequestSecureCookies()
|
||||||
@ -262,7 +262,7 @@ class AbstractBrowserTest extends TestCase
|
|||||||
|
|
||||||
$client->click($crawler->filter('a')->link());
|
$client->click($crawler->filter('a')->link());
|
||||||
|
|
||||||
$this->assertEquals('http://www.example.com/foo', $client->getRequest()->getUri(), '->click() clicks on links');
|
$this->assertSame('http://www.example.com/foo', $client->getRequest()->getUri(), '->click() clicks on links');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testClickLink()
|
public function testClickLink()
|
||||||
@ -272,7 +272,7 @@ class AbstractBrowserTest extends TestCase
|
|||||||
$client->request('GET', 'http://www.example.com/foo/foobar');
|
$client->request('GET', 'http://www.example.com/foo/foobar');
|
||||||
$client->clickLink('foo');
|
$client->clickLink('foo');
|
||||||
|
|
||||||
$this->assertEquals('http://www.example.com/foo', $client->getRequest()->getUri(), '->click() clicks on links');
|
$this->assertSame('http://www.example.com/foo', $client->getRequest()->getUri(), '->click() clicks on links');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testClickLinkNotFound()
|
public function testClickLinkNotFound()
|
||||||
@ -297,7 +297,7 @@ class AbstractBrowserTest extends TestCase
|
|||||||
|
|
||||||
$client->click($crawler->filter('input')->form());
|
$client->click($crawler->filter('input')->form());
|
||||||
|
|
||||||
$this->assertEquals('http://www.example.com/foo', $client->getRequest()->getUri(), '->click() Form submit forms');
|
$this->assertSame('http://www.example.com/foo', $client->getRequest()->getUri(), '->click() Form submit forms');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSubmit()
|
public function testSubmit()
|
||||||
@ -308,7 +308,7 @@ class AbstractBrowserTest extends TestCase
|
|||||||
|
|
||||||
$client->submit($crawler->filter('input')->form());
|
$client->submit($crawler->filter('input')->form());
|
||||||
|
|
||||||
$this->assertEquals('http://www.example.com/foo', $client->getRequest()->getUri(), '->submit() submit forms');
|
$this->assertSame('http://www.example.com/foo', $client->getRequest()->getUri(), '->submit() submit forms');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSubmitForm()
|
public function testSubmitForm()
|
||||||
@ -324,11 +324,11 @@ class AbstractBrowserTest extends TestCase
|
|||||||
'HTTP_USER_AGENT' => 'Symfony User Agent',
|
'HTTP_USER_AGENT' => 'Symfony User Agent',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->assertEquals('http://www.example.com/foo', $client->getRequest()->getUri(), '->submitForm() submit forms');
|
$this->assertSame('http://www.example.com/foo', $client->getRequest()->getUri(), '->submitForm() submit forms');
|
||||||
$this->assertEquals('PUT', $client->getRequest()->getMethod(), '->submitForm() allows to change the method');
|
$this->assertSame('PUT', $client->getRequest()->getMethod(), '->submitForm() allows to change the method');
|
||||||
$this->assertEquals('new username', $client->getRequest()->getParameters()['username'], '->submitForm() allows to override the form values');
|
$this->assertSame('new username', $client->getRequest()->getParameters()['username'], '->submitForm() allows to override the form values');
|
||||||
$this->assertEquals('new password', $client->getRequest()->getParameters()['password'], '->submitForm() allows to override the form values');
|
$this->assertSame('new password', $client->getRequest()->getParameters()['password'], '->submitForm() allows to override the form values');
|
||||||
$this->assertEquals('Symfony User Agent', $client->getRequest()->getServer()['HTTP_USER_AGENT'], '->submitForm() allows to change the $_SERVER parameters');
|
$this->assertSame('Symfony User Agent', $client->getRequest()->getServer()['HTTP_USER_AGENT'], '->submitForm() allows to change the $_SERVER parameters');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSubmitFormNotFound()
|
public function testSubmitFormNotFound()
|
||||||
@ -356,19 +356,19 @@ class AbstractBrowserTest extends TestCase
|
|||||||
|
|
||||||
$server = $client->getRequest()->getServer();
|
$server = $client->getRequest()->getServer();
|
||||||
$this->assertArrayHasKey('PHP_AUTH_USER', $server);
|
$this->assertArrayHasKey('PHP_AUTH_USER', $server);
|
||||||
$this->assertEquals('foo', $server['PHP_AUTH_USER']);
|
$this->assertSame('foo', $server['PHP_AUTH_USER']);
|
||||||
$this->assertArrayHasKey('PHP_AUTH_PW', $server);
|
$this->assertArrayHasKey('PHP_AUTH_PW', $server);
|
||||||
$this->assertEquals('bar', $server['PHP_AUTH_PW']);
|
$this->assertSame('bar', $server['PHP_AUTH_PW']);
|
||||||
|
|
||||||
$client->submit($crawler->filter('input')->form());
|
$client->submit($crawler->filter('input')->form());
|
||||||
|
|
||||||
$this->assertEquals('http://www.example.com/foo', $client->getRequest()->getUri(), '->submit() submit forms');
|
$this->assertSame('http://www.example.com/foo', $client->getRequest()->getUri(), '->submit() submit forms');
|
||||||
|
|
||||||
$server = $client->getRequest()->getServer();
|
$server = $client->getRequest()->getServer();
|
||||||
$this->assertArrayHasKey('PHP_AUTH_USER', $server);
|
$this->assertArrayHasKey('PHP_AUTH_USER', $server);
|
||||||
$this->assertEquals('foo', $server['PHP_AUTH_USER']);
|
$this->assertSame('foo', $server['PHP_AUTH_USER']);
|
||||||
$this->assertArrayHasKey('PHP_AUTH_PW', $server);
|
$this->assertArrayHasKey('PHP_AUTH_PW', $server);
|
||||||
$this->assertEquals('bar', $server['PHP_AUTH_PW']);
|
$this->assertSame('bar', $server['PHP_AUTH_PW']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSubmitPassthrewHeaders()
|
public function testSubmitPassthrewHeaders()
|
||||||
@ -382,7 +382,7 @@ class AbstractBrowserTest extends TestCase
|
|||||||
|
|
||||||
$server = $client->getRequest()->getServer();
|
$server = $client->getRequest()->getServer();
|
||||||
$this->assertArrayHasKey('Accept-Language', $server);
|
$this->assertArrayHasKey('Accept-Language', $server);
|
||||||
$this->assertEquals('de', $server['Accept-Language']);
|
$this->assertSame('de', $server['Accept-Language']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFollowRedirect()
|
public function testFollowRedirect()
|
||||||
@ -402,19 +402,19 @@ class AbstractBrowserTest extends TestCase
|
|||||||
$client->request('GET', 'http://www.example.com/foo/foobar');
|
$client->request('GET', 'http://www.example.com/foo/foobar');
|
||||||
$client->followRedirect();
|
$client->followRedirect();
|
||||||
|
|
||||||
$this->assertEquals('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() follows a redirect if any');
|
$this->assertSame('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() follows a redirect if any');
|
||||||
|
|
||||||
$client = $this->getBrowser();
|
$client = $this->getBrowser();
|
||||||
$client->setNextResponse(new Response('', 302, ['Location' => 'http://www.example.com/redirected']));
|
$client->setNextResponse(new Response('', 302, ['Location' => 'http://www.example.com/redirected']));
|
||||||
$client->request('GET', 'http://www.example.com/foo/foobar');
|
$client->request('GET', 'http://www.example.com/foo/foobar');
|
||||||
|
|
||||||
$this->assertEquals('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() automatically follows redirects if followRedirects is true');
|
$this->assertSame('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() automatically follows redirects if followRedirects is true');
|
||||||
|
|
||||||
$client = $this->getBrowser();
|
$client = $this->getBrowser();
|
||||||
$client->setNextResponse(new Response('', 201, ['Location' => 'http://www.example.com/redirected']));
|
$client->setNextResponse(new Response('', 201, ['Location' => 'http://www.example.com/redirected']));
|
||||||
$client->request('GET', 'http://www.example.com/foo/foobar');
|
$client->request('GET', 'http://www.example.com/foo/foobar');
|
||||||
|
|
||||||
$this->assertEquals('http://www.example.com/foo/foobar', $client->getRequest()->getUri(), '->followRedirect() does not follow redirect if HTTP Code is not 30x');
|
$this->assertSame('http://www.example.com/foo/foobar', $client->getRequest()->getUri(), '->followRedirect() does not follow redirect if HTTP Code is not 30x');
|
||||||
|
|
||||||
$client = $this->getBrowser();
|
$client = $this->getBrowser();
|
||||||
$client->setNextResponse(new Response('', 201, ['Location' => 'http://www.example.com/redirected']));
|
$client->setNextResponse(new Response('', 201, ['Location' => 'http://www.example.com/redirected']));
|
||||||
@ -434,12 +434,12 @@ class AbstractBrowserTest extends TestCase
|
|||||||
$client = $this->getBrowser();
|
$client = $this->getBrowser();
|
||||||
$client->setNextResponse(new Response('', 302, ['Location' => '/redirected']));
|
$client->setNextResponse(new Response('', 302, ['Location' => '/redirected']));
|
||||||
$client->request('GET', 'http://www.example.com/foo/foobar');
|
$client->request('GET', 'http://www.example.com/foo/foobar');
|
||||||
$this->assertEquals('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() follows a redirect if any');
|
$this->assertSame('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() follows a redirect if any');
|
||||||
|
|
||||||
$client = $this->getBrowser();
|
$client = $this->getBrowser();
|
||||||
$client->setNextResponse(new Response('', 302, ['Location' => '/redirected:1234']));
|
$client->setNextResponse(new Response('', 302, ['Location' => '/redirected:1234']));
|
||||||
$client->request('GET', 'http://www.example.com/foo/foobar');
|
$client->request('GET', 'http://www.example.com/foo/foobar');
|
||||||
$this->assertEquals('http://www.example.com/redirected:1234', $client->getRequest()->getUri(), '->followRedirect() follows relative urls');
|
$this->assertSame('http://www.example.com/redirected:1234', $client->getRequest()->getUri(), '->followRedirect() follows relative urls');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFollowRedirectWithMaxRedirects()
|
public function testFollowRedirectWithMaxRedirects()
|
||||||
@ -448,7 +448,7 @@ class AbstractBrowserTest extends TestCase
|
|||||||
$client->setMaxRedirects(1);
|
$client->setMaxRedirects(1);
|
||||||
$client->setNextResponse(new Response('', 302, ['Location' => 'http://www.example.com/redirected']));
|
$client->setNextResponse(new Response('', 302, ['Location' => 'http://www.example.com/redirected']));
|
||||||
$client->request('GET', 'http://www.example.com/foo/foobar');
|
$client->request('GET', 'http://www.example.com/foo/foobar');
|
||||||
$this->assertEquals('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() follows a redirect if any');
|
$this->assertSame('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() follows a redirect if any');
|
||||||
|
|
||||||
$client->setNextResponse(new Response('', 302, ['Location' => 'http://www.example.com/redirected2']));
|
$client->setNextResponse(new Response('', 302, ['Location' => 'http://www.example.com/redirected2']));
|
||||||
try {
|
try {
|
||||||
@ -460,25 +460,25 @@ class AbstractBrowserTest extends TestCase
|
|||||||
|
|
||||||
$client->setNextResponse(new Response('', 302, ['Location' => 'http://www.example.com/redirected']));
|
$client->setNextResponse(new Response('', 302, ['Location' => 'http://www.example.com/redirected']));
|
||||||
$client->request('GET', 'http://www.example.com/foo/foobar');
|
$client->request('GET', 'http://www.example.com/foo/foobar');
|
||||||
$this->assertEquals('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() follows a redirect if any');
|
$this->assertSame('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() follows a redirect if any');
|
||||||
|
|
||||||
$client->setNextResponse(new Response('', 302, ['Location' => '/redirected']));
|
$client->setNextResponse(new Response('', 302, ['Location' => '/redirected']));
|
||||||
$client->request('GET', 'http://www.example.com/foo/foobar');
|
$client->request('GET', 'http://www.example.com/foo/foobar');
|
||||||
|
|
||||||
$this->assertEquals('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() follows relative URLs');
|
$this->assertSame('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() follows relative URLs');
|
||||||
|
|
||||||
$client = $this->getBrowser();
|
$client = $this->getBrowser();
|
||||||
$client->setNextResponse(new Response('', 302, ['Location' => '//www.example.org/']));
|
$client->setNextResponse(new Response('', 302, ['Location' => '//www.example.org/']));
|
||||||
$client->request('GET', 'https://www.example.com/');
|
$client->request('GET', 'https://www.example.com/');
|
||||||
|
|
||||||
$this->assertEquals('https://www.example.org/', $client->getRequest()->getUri(), '->followRedirect() follows protocol-relative URLs');
|
$this->assertSame('https://www.example.org/', $client->getRequest()->getUri(), '->followRedirect() follows protocol-relative URLs');
|
||||||
|
|
||||||
$client = $this->getBrowser();
|
$client = $this->getBrowser();
|
||||||
$client->setNextResponse(new Response('', 302, ['Location' => 'http://www.example.com/redirected']));
|
$client->setNextResponse(new Response('', 302, ['Location' => 'http://www.example.com/redirected']));
|
||||||
$client->request('POST', 'http://www.example.com/foo/foobar', ['name' => 'bar']);
|
$client->request('POST', 'http://www.example.com/foo/foobar', ['name' => 'bar']);
|
||||||
|
|
||||||
$this->assertEquals('GET', $client->getRequest()->getMethod(), '->followRedirect() uses a GET for 302');
|
$this->assertSame('GET', $client->getRequest()->getMethod(), '->followRedirect() uses a GET for 302');
|
||||||
$this->assertEquals([], $client->getRequest()->getParameters(), '->followRedirect() does not submit parameters when changing the method');
|
$this->assertSame([], $client->getRequest()->getParameters(), '->followRedirect() does not submit parameters when changing the method');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFollowRedirectWithCookies()
|
public function testFollowRedirectWithCookies()
|
||||||
@ -490,9 +490,9 @@ class AbstractBrowserTest extends TestCase
|
|||||||
'Set-Cookie' => 'foo=bar',
|
'Set-Cookie' => 'foo=bar',
|
||||||
]));
|
]));
|
||||||
$client->request('GET', 'http://www.example.com/');
|
$client->request('GET', 'http://www.example.com/');
|
||||||
$this->assertEquals([], $client->getRequest()->getCookies());
|
$this->assertSame([], $client->getRequest()->getCookies());
|
||||||
$client->followRedirect();
|
$client->followRedirect();
|
||||||
$this->assertEquals(['foo' => 'bar'], $client->getRequest()->getCookies());
|
$this->assertSame(['foo' => 'bar'], $client->getRequest()->getCookies());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFollowRedirectWithHeaders()
|
public function testFollowRedirectWithHeaders()
|
||||||
@ -551,9 +551,9 @@ class AbstractBrowserTest extends TestCase
|
|||||||
public function testGetMaxRedirects()
|
public function testGetMaxRedirects()
|
||||||
{
|
{
|
||||||
$client = $this->getBrowser();
|
$client = $this->getBrowser();
|
||||||
$this->assertEquals(-1, $client->getMaxRedirects(), '->getMaxRedirects() returns default value');
|
$this->assertSame(-1, $client->getMaxRedirects(), '->getMaxRedirects() returns default value');
|
||||||
$client->setMaxRedirects(3);
|
$client->setMaxRedirects(3);
|
||||||
$this->assertEquals(3, $client->getMaxRedirects(), '->getMaxRedirects() returns assigned value');
|
$this->assertSame(3, $client->getMaxRedirects(), '->getMaxRedirects() returns assigned value');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFollowRedirectWithPostMethod()
|
public function testFollowRedirectWithPostMethod()
|
||||||
@ -568,12 +568,12 @@ class AbstractBrowserTest extends TestCase
|
|||||||
$client->setNextResponse(new Response('', 307, ['Location' => 'http://www.example.com/redirected']));
|
$client->setNextResponse(new Response('', 307, ['Location' => 'http://www.example.com/redirected']));
|
||||||
$client->request('POST', 'http://www.example.com/foo/foobar', $parameters, $files, $server, $content);
|
$client->request('POST', 'http://www.example.com/foo/foobar', $parameters, $files, $server, $content);
|
||||||
|
|
||||||
$this->assertEquals('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() follows a redirect with POST method');
|
$this->assertSame('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() follows a redirect with POST method');
|
||||||
$this->assertArrayHasKey('foo', $client->getRequest()->getParameters(), '->followRedirect() keeps parameters with POST method');
|
$this->assertArrayHasKey('foo', $client->getRequest()->getParameters(), '->followRedirect() keeps parameters with POST method');
|
||||||
$this->assertArrayHasKey('myfile.foo', $client->getRequest()->getFiles(), '->followRedirect() keeps files with POST method');
|
$this->assertArrayHasKey('myfile.foo', $client->getRequest()->getFiles(), '->followRedirect() keeps files with POST method');
|
||||||
$this->assertArrayHasKey('X_TEST_FOO', $client->getRequest()->getServer(), '->followRedirect() keeps $_SERVER with POST method');
|
$this->assertArrayHasKey('X_TEST_FOO', $client->getRequest()->getServer(), '->followRedirect() keeps $_SERVER with POST method');
|
||||||
$this->assertEquals($content, $client->getRequest()->getContent(), '->followRedirect() keeps content with POST method');
|
$this->assertSame($content, $client->getRequest()->getContent(), '->followRedirect() keeps content with POST method');
|
||||||
$this->assertEquals('POST', $client->getRequest()->getMethod(), '->followRedirect() keeps request method');
|
$this->assertSame('POST', $client->getRequest()->getMethod(), '->followRedirect() keeps request method');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFollowRedirectDropPostMethod()
|
public function testFollowRedirectDropPostMethod()
|
||||||
@ -589,12 +589,12 @@ class AbstractBrowserTest extends TestCase
|
|||||||
$client->setNextResponse(new Response('', $code, ['Location' => 'http://www.example.com/redirected']));
|
$client->setNextResponse(new Response('', $code, ['Location' => 'http://www.example.com/redirected']));
|
||||||
$client->request('POST', 'http://www.example.com/foo/foobar', $parameters, $files, $server, $content);
|
$client->request('POST', 'http://www.example.com/foo/foobar', $parameters, $files, $server, $content);
|
||||||
|
|
||||||
$this->assertEquals('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() follows a redirect with POST method on response code: '.$code.'.');
|
$this->assertSame('http://www.example.com/redirected', $client->getRequest()->getUri(), '->followRedirect() follows a redirect with POST method on response code: '.$code.'.');
|
||||||
$this->assertEmpty($client->getRequest()->getParameters(), '->followRedirect() drops parameters with POST method on response code: '.$code.'.');
|
$this->assertEmpty($client->getRequest()->getParameters(), '->followRedirect() drops parameters with POST method on response code: '.$code.'.');
|
||||||
$this->assertEmpty($client->getRequest()->getFiles(), '->followRedirect() drops files with POST method on response code: '.$code.'.');
|
$this->assertEmpty($client->getRequest()->getFiles(), '->followRedirect() drops files with POST method on response code: '.$code.'.');
|
||||||
$this->assertArrayHasKey('X_TEST_FOO', $client->getRequest()->getServer(), '->followRedirect() keeps $_SERVER with POST method on response code: '.$code.'.');
|
$this->assertArrayHasKey('X_TEST_FOO', $client->getRequest()->getServer(), '->followRedirect() keeps $_SERVER with POST method on response code: '.$code.'.');
|
||||||
$this->assertEmpty($client->getRequest()->getContent(), '->followRedirect() drops content with POST method on response code: '.$code.'.');
|
$this->assertEmpty($client->getRequest()->getContent(), '->followRedirect() drops content with POST method on response code: '.$code.'.');
|
||||||
$this->assertEquals('GET', $client->getRequest()->getMethod(), '->followRedirect() drops request method to GET on response code: '.$code.'.');
|
$this->assertSame('GET', $client->getRequest()->getMethod(), '->followRedirect() drops request method to GET on response code: '.$code.'.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -607,7 +607,7 @@ class AbstractBrowserTest extends TestCase
|
|||||||
$client->followMetaRefresh($followMetaRefresh);
|
$client->followMetaRefresh($followMetaRefresh);
|
||||||
$client->setNextResponse(new Response($content));
|
$client->setNextResponse(new Response($content));
|
||||||
$client->request('GET', 'http://www.example.com/foo/foobar');
|
$client->request('GET', 'http://www.example.com/foo/foobar');
|
||||||
$this->assertEquals($expectedEndingUrl, $client->getRequest()->getUri());
|
$this->assertSame($expectedEndingUrl, $client->getRequest()->getUri());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTestsForMetaRefresh()
|
public function getTestsForMetaRefresh()
|
||||||
@ -644,11 +644,11 @@ class AbstractBrowserTest extends TestCase
|
|||||||
$client->request('GET', 'http://www.example.com/foo');
|
$client->request('GET', 'http://www.example.com/foo');
|
||||||
$client->back();
|
$client->back();
|
||||||
|
|
||||||
$this->assertEquals('http://www.example.com/foo/foobar', $client->getRequest()->getUri(), '->back() goes back in the history');
|
$this->assertSame('http://www.example.com/foo/foobar', $client->getRequest()->getUri(), '->back() goes back in the history');
|
||||||
$this->assertArrayHasKey('foo', $client->getRequest()->getParameters(), '->back() keeps parameters');
|
$this->assertArrayHasKey('foo', $client->getRequest()->getParameters(), '->back() keeps parameters');
|
||||||
$this->assertArrayHasKey('myfile.foo', $client->getRequest()->getFiles(), '->back() keeps files');
|
$this->assertArrayHasKey('myfile.foo', $client->getRequest()->getFiles(), '->back() keeps files');
|
||||||
$this->assertArrayHasKey('X_TEST_FOO', $client->getRequest()->getServer(), '->back() keeps $_SERVER');
|
$this->assertArrayHasKey('X_TEST_FOO', $client->getRequest()->getServer(), '->back() keeps $_SERVER');
|
||||||
$this->assertEquals($content, $client->getRequest()->getContent(), '->back() keeps content');
|
$this->assertSame($content, $client->getRequest()->getContent(), '->back() keeps content');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testForward()
|
public function testForward()
|
||||||
@ -665,11 +665,11 @@ class AbstractBrowserTest extends TestCase
|
|||||||
$client->back();
|
$client->back();
|
||||||
$client->forward();
|
$client->forward();
|
||||||
|
|
||||||
$this->assertEquals('http://www.example.com/foo', $client->getRequest()->getUri(), '->forward() goes forward in the history');
|
$this->assertSame('http://www.example.com/foo', $client->getRequest()->getUri(), '->forward() goes forward in the history');
|
||||||
$this->assertArrayHasKey('foo', $client->getRequest()->getParameters(), '->forward() keeps parameters');
|
$this->assertArrayHasKey('foo', $client->getRequest()->getParameters(), '->forward() keeps parameters');
|
||||||
$this->assertArrayHasKey('myfile.foo', $client->getRequest()->getFiles(), '->forward() keeps files');
|
$this->assertArrayHasKey('myfile.foo', $client->getRequest()->getFiles(), '->forward() keeps files');
|
||||||
$this->assertArrayHasKey('X_TEST_FOO', $client->getRequest()->getServer(), '->forward() keeps $_SERVER');
|
$this->assertArrayHasKey('X_TEST_FOO', $client->getRequest()->getServer(), '->forward() keeps $_SERVER');
|
||||||
$this->assertEquals($content, $client->getRequest()->getContent(), '->forward() keeps content');
|
$this->assertSame($content, $client->getRequest()->getContent(), '->forward() keeps content');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testBackAndFrowardWithRedirects()
|
public function testBackAndFrowardWithRedirects()
|
||||||
@ -680,15 +680,15 @@ class AbstractBrowserTest extends TestCase
|
|||||||
$client->setNextResponse(new Response('', 301, ['Location' => 'http://www.example.com/redirected']));
|
$client->setNextResponse(new Response('', 301, ['Location' => 'http://www.example.com/redirected']));
|
||||||
$client->request('GET', 'http://www.example.com/bar');
|
$client->request('GET', 'http://www.example.com/bar');
|
||||||
|
|
||||||
$this->assertEquals('http://www.example.com/redirected', $client->getRequest()->getUri(), 'client followed redirect');
|
$this->assertSame('http://www.example.com/redirected', $client->getRequest()->getUri(), 'client followed redirect');
|
||||||
|
|
||||||
$client->back();
|
$client->back();
|
||||||
|
|
||||||
$this->assertEquals('http://www.example.com/foo', $client->getRequest()->getUri(), '->back() goes back in the history skipping redirects');
|
$this->assertSame('http://www.example.com/foo', $client->getRequest()->getUri(), '->back() goes back in the history skipping redirects');
|
||||||
|
|
||||||
$client->forward();
|
$client->forward();
|
||||||
|
|
||||||
$this->assertEquals('http://www.example.com/redirected', $client->getRequest()->getUri(), '->forward() goes forward in the history skipping redirects');
|
$this->assertSame('http://www.example.com/redirected', $client->getRequest()->getUri(), '->forward() goes forward in the history skipping redirects');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testReload()
|
public function testReload()
|
||||||
@ -703,11 +703,11 @@ class AbstractBrowserTest extends TestCase
|
|||||||
$client->request('GET', 'http://www.example.com/foo/foobar', $parameters, $files, $server, $content);
|
$client->request('GET', 'http://www.example.com/foo/foobar', $parameters, $files, $server, $content);
|
||||||
$client->reload();
|
$client->reload();
|
||||||
|
|
||||||
$this->assertEquals('http://www.example.com/foo/foobar', $client->getRequest()->getUri(), '->reload() reloads the current page');
|
$this->assertSame('http://www.example.com/foo/foobar', $client->getRequest()->getUri(), '->reload() reloads the current page');
|
||||||
$this->assertArrayHasKey('foo', $client->getRequest()->getParameters(), '->reload() keeps parameters');
|
$this->assertArrayHasKey('foo', $client->getRequest()->getParameters(), '->reload() keeps parameters');
|
||||||
$this->assertArrayHasKey('myfile.foo', $client->getRequest()->getFiles(), '->reload() keeps files');
|
$this->assertArrayHasKey('myfile.foo', $client->getRequest()->getFiles(), '->reload() keeps files');
|
||||||
$this->assertArrayHasKey('X_TEST_FOO', $client->getRequest()->getServer(), '->reload() keeps $_SERVER');
|
$this->assertArrayHasKey('X_TEST_FOO', $client->getRequest()->getServer(), '->reload() keeps $_SERVER');
|
||||||
$this->assertEquals($content, $client->getRequest()->getContent(), '->reload() keeps content');
|
$this->assertSame($content, $client->getRequest()->getContent(), '->reload() keeps content');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRestart()
|
public function testRestart()
|
||||||
@ -717,7 +717,7 @@ class AbstractBrowserTest extends TestCase
|
|||||||
$client->restart();
|
$client->restart();
|
||||||
|
|
||||||
$this->assertTrue($client->getHistory()->isEmpty(), '->restart() clears the history');
|
$this->assertTrue($client->getHistory()->isEmpty(), '->restart() clears the history');
|
||||||
$this->assertEquals([], $client->getCookieJar()->all(), '->restart() clears the cookies');
|
$this->assertSame([], $client->getCookieJar()->all(), '->restart() clears the cookies');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -730,7 +730,7 @@ class AbstractBrowserTest extends TestCase
|
|||||||
$client->setNextScript("new Symfony\Component\BrowserKit\Response('foobar')");
|
$client->setNextScript("new Symfony\Component\BrowserKit\Response('foobar')");
|
||||||
$client->request('GET', 'http://www.example.com/foo/foobar');
|
$client->request('GET', 'http://www.example.com/foo/foobar');
|
||||||
|
|
||||||
$this->assertEquals('foobar', $client->getResponse()->getContent(), '->insulate() process the request in a forked process');
|
$this->assertSame('foobar', $client->getResponse()->getContent(), '->insulate() process the request in a forked process');
|
||||||
|
|
||||||
$client->setNextScript("new Symfony\Component\BrowserKit\Response('foobar)");
|
$client->setNextScript("new Symfony\Component\BrowserKit\Response('foobar)");
|
||||||
|
|
||||||
@ -745,31 +745,31 @@ class AbstractBrowserTest extends TestCase
|
|||||||
public function testGetServerParameter()
|
public function testGetServerParameter()
|
||||||
{
|
{
|
||||||
$client = $this->getBrowser();
|
$client = $this->getBrowser();
|
||||||
$this->assertEquals('', $client->getServerParameter('HTTP_HOST'));
|
$this->assertSame('', $client->getServerParameter('HTTP_HOST'));
|
||||||
$this->assertEquals('Symfony BrowserKit', $client->getServerParameter('HTTP_USER_AGENT'));
|
$this->assertSame('Symfony BrowserKit', $client->getServerParameter('HTTP_USER_AGENT'));
|
||||||
$this->assertEquals('testvalue', $client->getServerParameter('testkey', 'testvalue'));
|
$this->assertSame('testvalue', $client->getServerParameter('testkey', 'testvalue'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetServerParameter()
|
public function testSetServerParameter()
|
||||||
{
|
{
|
||||||
$client = $this->getBrowser();
|
$client = $this->getBrowser();
|
||||||
|
|
||||||
$this->assertEquals('', $client->getServerParameter('HTTP_HOST'));
|
$this->assertSame('', $client->getServerParameter('HTTP_HOST'));
|
||||||
$this->assertEquals('Symfony BrowserKit', $client->getServerParameter('HTTP_USER_AGENT'));
|
$this->assertSame('Symfony BrowserKit', $client->getServerParameter('HTTP_USER_AGENT'));
|
||||||
|
|
||||||
$client->setServerParameter('HTTP_HOST', 'testhost');
|
$client->setServerParameter('HTTP_HOST', 'testhost');
|
||||||
$this->assertEquals('testhost', $client->getServerParameter('HTTP_HOST'));
|
$this->assertSame('testhost', $client->getServerParameter('HTTP_HOST'));
|
||||||
|
|
||||||
$client->setServerParameter('HTTP_USER_AGENT', 'testua');
|
$client->setServerParameter('HTTP_USER_AGENT', 'testua');
|
||||||
$this->assertEquals('testua', $client->getServerParameter('HTTP_USER_AGENT'));
|
$this->assertSame('testua', $client->getServerParameter('HTTP_USER_AGENT'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetServerParameterInRequest()
|
public function testSetServerParameterInRequest()
|
||||||
{
|
{
|
||||||
$client = $this->getBrowser();
|
$client = $this->getBrowser();
|
||||||
|
|
||||||
$this->assertEquals('', $client->getServerParameter('HTTP_HOST'));
|
$this->assertSame('', $client->getServerParameter('HTTP_HOST'));
|
||||||
$this->assertEquals('Symfony BrowserKit', $client->getServerParameter('HTTP_USER_AGENT'));
|
$this->assertSame('Symfony BrowserKit', $client->getServerParameter('HTTP_USER_AGENT'));
|
||||||
|
|
||||||
$client->request('GET', 'https://www.example.com/https/www.example.com', [], [], [
|
$client->request('GET', 'https://www.example.com/https/www.example.com', [], [], [
|
||||||
'HTTP_HOST' => 'testhost',
|
'HTTP_HOST' => 'testhost',
|
||||||
@ -778,21 +778,21 @@ class AbstractBrowserTest extends TestCase
|
|||||||
'NEW_SERVER_KEY' => 'new-server-key-value',
|
'NEW_SERVER_KEY' => 'new-server-key-value',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->assertEquals('', $client->getServerParameter('HTTP_HOST'));
|
$this->assertSame('', $client->getServerParameter('HTTP_HOST'));
|
||||||
$this->assertEquals('Symfony BrowserKit', $client->getServerParameter('HTTP_USER_AGENT'));
|
$this->assertSame('Symfony BrowserKit', $client->getServerParameter('HTTP_USER_AGENT'));
|
||||||
|
|
||||||
$this->assertEquals('https://www.example.com/https/www.example.com', $client->getRequest()->getUri());
|
$this->assertSame('https://www.example.com/https/www.example.com', $client->getRequest()->getUri());
|
||||||
|
|
||||||
$server = $client->getRequest()->getServer();
|
$server = $client->getRequest()->getServer();
|
||||||
|
|
||||||
$this->assertArrayHasKey('HTTP_USER_AGENT', $server);
|
$this->assertArrayHasKey('HTTP_USER_AGENT', $server);
|
||||||
$this->assertEquals('testua', $server['HTTP_USER_AGENT']);
|
$this->assertSame('testua', $server['HTTP_USER_AGENT']);
|
||||||
|
|
||||||
$this->assertArrayHasKey('HTTP_HOST', $server);
|
$this->assertArrayHasKey('HTTP_HOST', $server);
|
||||||
$this->assertEquals('testhost', $server['HTTP_HOST']);
|
$this->assertSame('testhost', $server['HTTP_HOST']);
|
||||||
|
|
||||||
$this->assertArrayHasKey('NEW_SERVER_KEY', $server);
|
$this->assertArrayHasKey('NEW_SERVER_KEY', $server);
|
||||||
$this->assertEquals('new-server-key-value', $server['NEW_SERVER_KEY']);
|
$this->assertSame('new-server-key-value', $server['NEW_SERVER_KEY']);
|
||||||
|
|
||||||
$this->assertArrayHasKey('HTTPS', $server);
|
$this->assertArrayHasKey('HTTPS', $server);
|
||||||
$this->assertTrue($server['HTTPS']);
|
$this->assertTrue($server['HTTPS']);
|
||||||
@ -806,13 +806,13 @@ class AbstractBrowserTest extends TestCase
|
|||||||
'HTTP_HOST' => 'testhost',
|
'HTTP_HOST' => 'testhost',
|
||||||
'HTTPS' => true,
|
'HTTPS' => true,
|
||||||
]);
|
]);
|
||||||
$this->assertEquals('https://testhost/', $client->getRequest()->getUri());
|
$this->assertSame('https://testhost/', $client->getRequest()->getUri());
|
||||||
|
|
||||||
$client->request('GET', 'https://www.example.com/', [], [], [
|
$client->request('GET', 'https://www.example.com/', [], [], [
|
||||||
'HTTP_HOST' => 'testhost',
|
'HTTP_HOST' => 'testhost',
|
||||||
'HTTPS' => false,
|
'HTTPS' => false,
|
||||||
]);
|
]);
|
||||||
$this->assertEquals('https://www.example.com/', $client->getRequest()->getUri());
|
$this->assertSame('https://www.example.com/', $client->getRequest()->getUri());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testInternalRequest()
|
public function testInternalRequest()
|
||||||
|
@ -35,10 +35,6 @@ class PdoDbalAdapterTest extends AdapterTestCase
|
|||||||
self::markTestSkipped('Extension pdo_sqlite required.');
|
self::markTestSkipped('Extension pdo_sqlite required.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (\PHP_VERSION_ID >= 80000 && class_exists(Version::class)) {
|
|
||||||
self::markTestSkipped('Doctrine DBAL 2.x is incompatible with PHP 8.');
|
|
||||||
}
|
|
||||||
|
|
||||||
self::$dbFile = tempnam(sys_get_temp_dir(), 'sf_sqlite_cache');
|
self::$dbFile = tempnam(sys_get_temp_dir(), 'sf_sqlite_cache');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -504,6 +504,9 @@ EOF;
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$file = $r->getFileName();
|
$file = $r->getFileName();
|
||||||
|
if (') : eval()\'d code' === substr($file, -17)) {
|
||||||
|
$file = substr($file, 0, strrpos($file, '(', -17));
|
||||||
|
}
|
||||||
if (!$file || $this->doExport($file) === $exportedFile = $this->export($file)) {
|
if (!$file || $this->doExport($file) === $exportedFile = $this->export($file)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -114,6 +114,26 @@
|
|||||||
<source>Please provide a valid phone number.</source>
|
<source>Please provide a valid phone number.</source>
|
||||||
<target>Please provide a valid phone number.</target>
|
<target>Please provide a valid phone number.</target>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
<trans-unit id="124">
|
||||||
|
<source>The checkbox has an invalid value.</source>
|
||||||
|
<target>The checkbox has an invalid value.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="125">
|
||||||
|
<source>Please enter a valid email address.</source>
|
||||||
|
<target>Please enter a valid email address.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="126">
|
||||||
|
<source>Please select a valid option.</source>
|
||||||
|
<target>Please select a valid option.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="127">
|
||||||
|
<source>Please select a valid range.</source>
|
||||||
|
<target>Please select a valid range.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="128">
|
||||||
|
<source>Please enter a valid week.</source>
|
||||||
|
<target>Please enter a valid week.</target>
|
||||||
|
</trans-unit>
|
||||||
</body>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
||||||
|
@ -14,6 +14,126 @@
|
|||||||
<source>The CSRF token is invalid. Please try to resubmit the form.</source>
|
<source>The CSRF token is invalid. Please try to resubmit the form.</source>
|
||||||
<target>De CSRF-token is ongeldig. Probeer het formulier opnieuw te versturen.</target>
|
<target>De CSRF-token is ongeldig. Probeer het formulier opnieuw te versturen.</target>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
<trans-unit id="99">
|
||||||
|
<source>This value is not a valid HTML5 color.</source>
|
||||||
|
<target>Dit is geen geldige HTML5 kleur.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="100">
|
||||||
|
<source>Please enter a valid birthdate.</source>
|
||||||
|
<target>Vul een geldige geboortedatum in.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="101">
|
||||||
|
<source>The selected choice is invalid.</source>
|
||||||
|
<target>Deze keuze is ongeldig.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="102">
|
||||||
|
<source>The collection is invalid.</source>
|
||||||
|
<target>Deze collectie is ongeldig.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="103">
|
||||||
|
<source>Please select a valid color.</source>
|
||||||
|
<target>Kies een geldige kleur.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="104">
|
||||||
|
<source>Please select a valid country.</source>
|
||||||
|
<target>Kies een geldige landnaam.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="105">
|
||||||
|
<source>Please select a valid currency.</source>
|
||||||
|
<target>Kies een geldige valuta.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="106">
|
||||||
|
<source>Please choose a valid date interval.</source>
|
||||||
|
<target>Kies een geldig tijdinterval.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="107">
|
||||||
|
<source>Please enter a valid date and time.</source>
|
||||||
|
<target>Vul een geldige datum en tijd in.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="108">
|
||||||
|
<source>Please enter a valid date.</source>
|
||||||
|
<target>Vul een geldige datum in.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="109">
|
||||||
|
<source>Please select a valid file.</source>
|
||||||
|
<target>Kies een geldig bestand.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="110">
|
||||||
|
<source>The hidden field is invalid.</source>
|
||||||
|
<target>Het verborgen veld is incorrect.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="111">
|
||||||
|
<source>Please enter an integer.</source>
|
||||||
|
<target>Vul een geldig getal in.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="112">
|
||||||
|
<source>Please select a valid language.</source>
|
||||||
|
<target>Kies een geldige taal.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="113">
|
||||||
|
<source>Please select a valid locale.</source>
|
||||||
|
<target>Kies een geldige locale.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="114">
|
||||||
|
<source>Please enter a valid money amount.</source>
|
||||||
|
<target>Vul een geldig bedrag in.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="115">
|
||||||
|
<source>Please enter a number.</source>
|
||||||
|
<target>Vul een geldig getal in.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="116">
|
||||||
|
<source>The password is invalid.</source>
|
||||||
|
<target>Het wachtwoord is incorrect.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="117">
|
||||||
|
<source>Please enter a percentage value.</source>
|
||||||
|
<target>Vul een geldig percentage in.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="118">
|
||||||
|
<source>The values do not match.</source>
|
||||||
|
<target>De waardes komen niet overeen.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="119">
|
||||||
|
<source>Please enter a valid time.</source>
|
||||||
|
<target>Vul een geldige tijd in.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="120">
|
||||||
|
<source>Please select a valid timezone.</source>
|
||||||
|
<target>Vul een geldige tijdzone in.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="121">
|
||||||
|
<source>Please enter a valid URL.</source>
|
||||||
|
<target>Vul een geldige URL in.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="122">
|
||||||
|
<source>Please enter a valid search term.</source>
|
||||||
|
<target>Vul een geldige zoekterm in.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="123">
|
||||||
|
<source>Please provide a valid phone number.</source>
|
||||||
|
<target>Vul een geldig telefoonnummer in.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="124">
|
||||||
|
<source>The checkbox has an invalid value.</source>
|
||||||
|
<target>De checkbox heeft een incorrecte waarde.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="125">
|
||||||
|
<source>Please enter a valid email address.</source>
|
||||||
|
<target>Vul een geldig e-mailadres in.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="126">
|
||||||
|
<source>Please select a valid option.</source>
|
||||||
|
<target>Kies een geldige optie.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="127">
|
||||||
|
<source>Please select a valid range.</source>
|
||||||
|
<target>Kies een geldig bereik.</target>
|
||||||
|
</trans-unit>
|
||||||
|
<trans-unit id="128">
|
||||||
|
<source>Please enter a valid week.</source>
|
||||||
|
<target>Vul een geldige week in.</target>
|
||||||
|
</trans-unit>
|
||||||
</body>
|
</body>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
||||||
|
@ -231,33 +231,36 @@ class BinaryFileResponse extends Response
|
|||||||
$this->headers->set($type, $path);
|
$this->headers->set($type, $path);
|
||||||
$this->maxlen = 0;
|
$this->maxlen = 0;
|
||||||
}
|
}
|
||||||
} elseif ($request->headers->has('Range')) {
|
} elseif ($request->headers->has('Range') && $request->isMethod('GET')) {
|
||||||
// Process the range headers.
|
// Process the range headers.
|
||||||
if (!$request->headers->has('If-Range') || $this->hasValidIfRangeHeader($request->headers->get('If-Range'))) {
|
if (!$request->headers->has('If-Range') || $this->hasValidIfRangeHeader($request->headers->get('If-Range'))) {
|
||||||
$range = $request->headers->get('Range');
|
$range = $request->headers->get('Range');
|
||||||
|
|
||||||
list($start, $end) = explode('-', substr($range, 6), 2) + [0];
|
if (0 === strpos($range, 'bytes=')) {
|
||||||
|
list($start, $end) = explode('-', substr($range, 6), 2) + [0];
|
||||||
|
|
||||||
$end = ('' === $end) ? $fileSize - 1 : (int) $end;
|
$end = ('' === $end) ? $fileSize - 1 : (int) $end;
|
||||||
|
|
||||||
if ('' === $start) {
|
if ('' === $start) {
|
||||||
$start = $fileSize - $end;
|
$start = $fileSize - $end;
|
||||||
$end = $fileSize - 1;
|
$end = $fileSize - 1;
|
||||||
} else {
|
} else {
|
||||||
$start = (int) $start;
|
$start = (int) $start;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($start <= $end) {
|
if ($start <= $end) {
|
||||||
if ($start < 0 || $end > $fileSize - 1) {
|
$end = min($end, $fileSize - 1);
|
||||||
$this->setStatusCode(416);
|
if ($start < 0 || $start > $end) {
|
||||||
$this->headers->set('Content-Range', sprintf('bytes */%s', $fileSize));
|
$this->setStatusCode(416);
|
||||||
} elseif (0 !== $start || $end !== $fileSize - 1) {
|
$this->headers->set('Content-Range', sprintf('bytes */%s', $fileSize));
|
||||||
$this->maxlen = $end < $fileSize ? $end - $start + 1 : -1;
|
} elseif ($end - $start < $fileSize - 1) {
|
||||||
$this->offset = $start;
|
$this->maxlen = $end < $fileSize ? $end - $start + 1 : -1;
|
||||||
|
$this->offset = $start;
|
||||||
|
|
||||||
$this->setStatusCode(206);
|
$this->setStatusCode(206);
|
||||||
$this->headers->set('Content-Range', sprintf('bytes %s-%s/%s', $start, $end, $fileSize));
|
$this->headers->set('Content-Range', sprintf('bytes %s-%s/%s', $start, $end, $fileSize));
|
||||||
$this->headers->set('Content-Length', $end - $start + 1);
|
$this->headers->set('Content-Length', $end - $start + 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -149,6 +149,7 @@ class BinaryFileResponseTest extends ResponseTestCase
|
|||||||
['bytes=30-', 30, 5, 'bytes 30-34/35'],
|
['bytes=30-', 30, 5, 'bytes 30-34/35'],
|
||||||
['bytes=30-30', 30, 1, 'bytes 30-30/35'],
|
['bytes=30-30', 30, 1, 'bytes 30-30/35'],
|
||||||
['bytes=30-34', 30, 5, 'bytes 30-34/35'],
|
['bytes=30-34', 30, 5, 'bytes 30-34/35'],
|
||||||
|
['bytes=30-40', 30, 5, 'bytes 30-34/35'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,9 +204,31 @@ class BinaryFileResponseTest extends ResponseTestCase
|
|||||||
// Syntactical invalid range-request should also return the full resource
|
// Syntactical invalid range-request should also return the full resource
|
||||||
['bytes=20-10'],
|
['bytes=20-10'],
|
||||||
['bytes=50-40'],
|
['bytes=50-40'],
|
||||||
|
// range units other than bytes must be ignored
|
||||||
|
['unknown=10-20'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testRangeOnPostMethod()
|
||||||
|
{
|
||||||
|
$request = Request::create('/', 'POST');
|
||||||
|
$request->headers->set('Range', 'bytes=10-20');
|
||||||
|
$response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200, ['Content-Type' => 'application/octet-stream']);
|
||||||
|
|
||||||
|
$file = fopen(__DIR__.'/File/Fixtures/test.gif', 'r');
|
||||||
|
$data = fread($file, 35);
|
||||||
|
fclose($file);
|
||||||
|
|
||||||
|
$this->expectOutputString($data);
|
||||||
|
$response = clone $response;
|
||||||
|
$response->prepare($request);
|
||||||
|
$response->sendContent();
|
||||||
|
|
||||||
|
$this->assertSame(200, $response->getStatusCode());
|
||||||
|
$this->assertSame('35', $response->headers->get('Content-Length'));
|
||||||
|
$this->assertNull($response->headers->get('Content-Range'));
|
||||||
|
}
|
||||||
|
|
||||||
public function testUnpreparedResponseSendsFullFile()
|
public function testUnpreparedResponseSendsFullFile()
|
||||||
{
|
{
|
||||||
$response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200);
|
$response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200);
|
||||||
@ -242,7 +265,7 @@ class BinaryFileResponseTest extends ResponseTestCase
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
['bytes=-40'],
|
['bytes=-40'],
|
||||||
['bytes=30-40'],
|
['bytes=40-50'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ class PropertyAccessor implements PropertyAccessorInterface
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
} catch (\TypeError $e) {
|
} catch (\TypeError $e) {
|
||||||
self::throwInvalidArgumentException($e->getMessage(), $e->getTrace(), 0, $propertyPath);
|
self::throwInvalidArgumentException($e->getMessage(), $e->getTrace(), 0, $propertyPath, $e);
|
||||||
// It wasn't thrown in this class so rethrow it
|
// It wasn't thrown in this class so rethrow it
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user