public function FileBagTest::testShouldConvertNestedUploadedFilesWithPhpBug

File

drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/FileBagTest.php, line 91

Class

FileBagTest
FileBagTest.

Namespace

Symfony\Component\HttpFoundation\Tests

Code

public function testShouldConvertNestedUploadedFilesWithPhpBug() {
  $tmpFile = $this
    ->createTempFile();
  $file = new UploadedFile($tmpFile, basename($tmpFile), 'text/plain', 100, 0);
  $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' => 100,
        ),
      ),
    ),
  ));
  $files = $bag
    ->all();
  $this
    ->assertEquals($file, $files['child']['sub']['file']);
}