mirror of
https://github.com/DirectoryLister/DirectoryLister.git
synced 2025-08-20 12:51:30 +02:00
Added a test case to SizeForHumansTest
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace Tests\ViewFunctions;
|
||||
|
||||
use App\ViewFunctions\SizeForHumans;
|
||||
use RuntimeException;
|
||||
use Symfony\Component\Finder\SplFileInfo;
|
||||
use Tests\TestCase;
|
||||
|
||||
@@ -78,4 +79,15 @@ class SizeForHumansTest extends TestCase
|
||||
|
||||
$this->assertEquals('8.00EB', $sizeForHumans($file));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function it_returns_zero_bytes_when_it_can_not_get_the_file_size(): void
|
||||
{
|
||||
$file = $this->createMock(SplFileInfo::class);
|
||||
$file->method('getSize')->willThrowException(new RuntimeException);
|
||||
|
||||
$sizeForHumans = new SizeForHumans;
|
||||
|
||||
$this->assertEquals('0B', $sizeForHumans($file));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user