mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-11-30 03:59:50 +09:00
43 lines
906 B
PHP
43 lines
906 B
PHP
<?php
|
|
|
|
namespace Tests\Unit\helpers;
|
|
|
|
use Tests\TestCase;
|
|
|
|
class IsImageTest extends TestCase
|
|
{
|
|
/**
|
|
* @return void
|
|
*/
|
|
public function test_returns_true_when_file_is_image(): void
|
|
{
|
|
$file = file_get_contents(__DIR__ . '/fixtures/heimdall-icon-small.png');
|
|
|
|
$actual = isImage($file, 'png');
|
|
|
|
$this->assertTrue($actual);
|
|
}
|
|
|
|
/**
|
|
* @return void
|
|
*/
|
|
public function test_returns_false_when_file_extension_is_image_but_content_is_not(): void
|
|
{
|
|
$actual = isImage("<?php ?>", "png");
|
|
|
|
$this->assertFalse($actual);
|
|
}
|
|
|
|
/**
|
|
* @return void
|
|
*/
|
|
public function test_returns_false_when_file_extension_is_not_image_but_content_is(): void
|
|
{
|
|
$file = file_get_contents(__DIR__ . '/fixtures/heimdall-icon-small.png');
|
|
|
|
$actual = isImage($file, 'php');
|
|
|
|
$this->assertFalse($actual);
|
|
}
|
|
}
|