Files
fil/e2e/php/tests/DetectionTest.php

64 lines
1.9 KiB
PHP
Raw Permalink Normal View History

2026-06-01 23:40:55 +02:00
<?php
// This file is auto-generated by alef — DO NOT EDIT.
// alef:hash:4e15143f4af1ae8bafbdb1506ef057da924484c66a19483966333558ad437e75
// To regenerate: alef generate
// To verify freshness: alef verify --exit-code
// Issues & docs: https://github.com/kreuzberg-dev/alef
declare(strict_types=1);
namespace Kreuzberg\E2e;
use PHPUnit\Framework\TestCase;
use Kreuzberg\Kreuzberg;
use Kreuzberg\ExtractionConfig;
/** E2e tests for category: detection. */
final class DetectionTest extends TestCase
{
/** Detect HTML MIME from bytes */
public function test_detect_mime_bytes_html(): void
{
$contentBytes = file_get_contents("html/html.html");
if ($contentBytes === false) { $this->fail("failed to read fixture: html/html.html"); }
$this->expectNotToPerformAssertions();
$result = Kreuzberg::detectMimeTypeFromBytes($contentBytes);
}
/** Detect PDF MIME type from bytes */
public function test_detect_mime_bytes_pdf(): void
{
$contentBytes = file_get_contents("pdf/fake_memo.pdf");
if ($contentBytes === false) { $this->fail("failed to read fixture: pdf/fake_memo.pdf"); }
$this->expectNotToPerformAssertions();
$result = Kreuzberg::detectMimeTypeFromBytes($contentBytes);
}
/** Detect PNG MIME type from bytes */
public function test_detect_mime_bytes_png(): void
{
$contentBytes = file_get_contents("images/test_hello_world.png");
if ($contentBytes === false) { $this->fail("failed to read fixture: images/test_hello_world.png"); }
$this->expectNotToPerformAssertions();
$result = Kreuzberg::detectMimeTypeFromBytes($contentBytes);
}
/** get_extensions unknown MIME */
public function test_get_extensions_unknown_mime(): void
{
$this->expectException(\Exception::class); Kreuzberg::getExtensionsForMime("application/x-totally-unknown");
}
}