summaryrefslogtreecommitdiff
path: root/vendor/symfony/http-foundation/Tests/FileBagTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/symfony/http-foundation/Tests/FileBagTest.php')
-rw-r--r--vendor/symfony/http-foundation/Tests/FileBagTest.php110
1 files changed, 55 insertions, 55 deletions
diff --git a/vendor/symfony/http-foundation/Tests/FileBagTest.php b/vendor/symfony/http-foundation/Tests/FileBagTest.php
index 06136e2097..5eaf64f89f 100644
--- a/vendor/symfony/http-foundation/Tests/FileBagTest.php
+++ b/vendor/symfony/http-foundation/Tests/FileBagTest.php
@@ -28,7 +28,7 @@ class FileBagTest extends TestCase
*/
public function testFileMustBeAnArrayOrUploadedFile()
{
- new FileBag(array('file' => 'foo'));
+ new FileBag(['file' => 'foo']);
}
public function testShouldConvertsUploadedFiles()
@@ -36,54 +36,54 @@ class FileBagTest extends TestCase
$tmpFile = $this->createTempFile();
$file = new UploadedFile($tmpFile, basename($tmpFile), 'text/plain');
- $bag = new FileBag(array('file' => array(
+ $bag = new FileBag(['file' => [
'name' => basename($tmpFile),
'type' => 'text/plain',
'tmp_name' => $tmpFile,
'error' => 0,
'size' => null,
- )));
+ ]]);
$this->assertEquals($file, $bag->get('file'));
}
public function testShouldSetEmptyUploadedFilesToNull()
{
- $bag = new FileBag(array('file' => array(
+ $bag = new FileBag(['file' => [
'name' => '',
'type' => '',
'tmp_name' => '',
'error' => UPLOAD_ERR_NO_FILE,
'size' => 0,
- )));
+ ]]);
$this->assertNull($bag->get('file'));
}
public function testShouldRemoveEmptyUploadedFilesForMultiUpload()
{
- $bag = new FileBag(array('files' => array(
- 'name' => array(''),
- 'type' => array(''),
- 'tmp_name' => array(''),
- 'error' => array(UPLOAD_ERR_NO_FILE),
- 'size' => array(0),
- )));
+ $bag = new FileBag(['files' => [
+ 'name' => [''],
+ 'type' => [''],
+ 'tmp_name' => [''],
+ 'error' => [UPLOAD_ERR_NO_FILE],
+ 'size' => [0],
+ ]]);
- $this->assertSame(array(), $bag->get('files'));
+ $this->assertSame([], $bag->get('files'));
}
public function testShouldNotRemoveEmptyUploadedFilesForAssociativeArray()
{
- $bag = new FileBag(array('files' => array(
- 'name' => array('file1' => ''),
- 'type' => array('file1' => ''),
- 'tmp_name' => array('file1' => ''),
- 'error' => array('file1' => UPLOAD_ERR_NO_FILE),
- 'size' => array('file1' => 0),
- )));
+ $bag = new FileBag(['files' => [
+ 'name' => ['file1' => ''],
+ 'type' => ['file1' => ''],
+ 'tmp_name' => ['file1' => ''],
+ 'error' => ['file1' => UPLOAD_ERR_NO_FILE],
+ 'size' => ['file1' => 0],
+ ]]);
- $this->assertSame(array('file1' => null), $bag->get('files'));
+ $this->assertSame(['file1' => null], $bag->get('files'));
}
public function testShouldConvertUploadedFilesWithPhpBug()
@@ -91,25 +91,25 @@ class FileBagTest extends TestCase
$tmpFile = $this->createTempFile();
$file = new UploadedFile($tmpFile, basename($tmpFile), 'text/plain');
- $bag = new FileBag(array(
- 'child' => array(
- 'name' => array(
+ $bag = new FileBag([
+ 'child' => [
+ 'name' => [
'file' => basename($tmpFile),
- ),
- 'type' => array(
+ ],
+ 'type' => [
'file' => 'text/plain',
- ),
- 'tmp_name' => array(
+ ],
+ 'tmp_name' => [
'file' => $tmpFile,
- ),
- 'error' => array(
+ ],
+ 'error' => [
'file' => 0,
- ),
- 'size' => array(
+ ],
+ 'size' => [
'file' => null,
- ),
- ),
- ));
+ ],
+ ],
+ ]);
$files = $bag->all();
$this->assertEquals($file, $files['child']['file']);
@@ -120,25 +120,25 @@ class FileBagTest extends TestCase
$tmpFile = $this->createTempFile();
$file = new UploadedFile($tmpFile, basename($tmpFile), 'text/plain');
- $bag = new FileBag(array(
- 'child' => array(
- 'name' => array(
- 'sub' => array('file' => basename($tmpFile)),
- ),
- 'type' => array(
- 'sub' => array('file' => 'text/plain'),
- ),
- 'tmp_name' => array(
- 'sub' => array('file' => $tmpFile),
- ),
- 'error' => array(
- 'sub' => array('file' => 0),
- ),
- 'size' => array(
- 'sub' => array('file' => null),
- ),
- ),
- ));
+ $bag = new FileBag([
+ 'child' => [
+ 'name' => [
+ 'sub' => ['file' => basename($tmpFile)],
+ ],
+ 'type' => [
+ 'sub' => ['file' => 'text/plain'],
+ ],
+ 'tmp_name' => [
+ 'sub' => ['file' => $tmpFile],
+ ],
+ 'error' => [
+ 'sub' => ['file' => 0],
+ ],
+ 'size' => [
+ 'sub' => ['file' => null],
+ ],
+ ],
+ ]);
$files = $bag->all();
$this->assertEquals($file, $files['child']['sub']['file']);
@@ -148,7 +148,7 @@ class FileBagTest extends TestCase
{
$tmpFile = $this->createTempFile();
$file = new UploadedFile($tmpFile, basename($tmpFile), 'text/plain');
- $bag = new FileBag(array('image' => array('file' => $file)));
+ $bag = new FileBag(['image' => ['file' => $file]]);
$files = $bag->all();
$this->assertEquals($file, $files['image']['file']);