1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
<?php
declare(strict_types=1);
namespace Shaarli\NetscapeBookmarkParser\Tests\Unit\Encoder;
use PHPUnit\Framework\TestCase;
use Shaarli\NetscapeBookmarkParser\Encoder\NetscapeBookmarkDecoder;
/**
* Ensure that trying to import an empty file is handled properly.
*/
class ParseEmptyFileTest extends TestCase
{
public const FIXTURE_DIRECTORY = __DIR__ . '/../../Fixtures/Encoder/';
/**
* @var NetscapeBookmarkDecoder|null
*/
private $decoder;
/**
* Parse empty file.
*/
public function testParseEmptyFile(): void
{
$content = file_get_contents(self::FIXTURE_DIRECTORY . 'input/empty.htm');
$result = $this->decoder->decode($content);
$this->assertIsArray($result);
$this->assertCount(0, $result);
}
// --------------------------------------------------
// Setup / Tear Down
// --------------------------------------------------
protected function setUp(): void
{
$this->decoder = new NetscapeBookmarkDecoder();
}
protected function tearDown(): void
{
$this->decoder = null;
}
}
|