Skip to content

Commit

Permalink
FileCollection should return empty array when no files exist.
Browse files Browse the repository at this point in the history
  • Loading branch information
lonnieezell committed Jul 6, 2017
1 parent b46b5f2 commit 69b9f68
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions system/HTTP/Files/FileCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,13 @@ protected function populateFiles()
return;
}

$this->files = [];

if (empty($_FILES))
{
return;
}

$this->files = [];

$files = $this->fixFilesArray($_FILES);

foreach ($files as $name => $file)
Expand Down
4 changes: 2 additions & 2 deletions tests/system/HTTP/Files/FileCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ public function setUp()

//--------------------------------------------------------------------

public function testAllReturnsNullWithNoFiles()
public function testAllReturnsArrayWithNoFiles()
{
$files = new FileCollection();

$this->assertNull($files->all());
$this->assertEquals([], $files->all());
}

//--------------------------------------------------------------------
Expand Down

0 comments on commit 69b9f68

Please sign in to comment.