fail("failed to read fixture: pdf/fake_memo.pdf"); } $result = Kreuzberg::detectMimeTypeFromBytes($contentBytes); $this->assertStringContainsString("pdf", $result); } /** Detect MIME type from PNG image bytes */ public function test_mime_detect_image(): void { $contentBytes = file_get_contents("images/test_hello_world.png"); if ($contentBytes === false) { $this->fail("failed to read fixture: images/test_hello_world.png"); } $result = Kreuzberg::detectMimeTypeFromBytes($contentBytes); $this->assertStringContainsString("png", $result); } /** Get file extensions for a MIME type */ public function test_mime_get_extensions(): void { $result = Kreuzberg::getExtensionsForMime("application/pdf"); $found = false; foreach ($result as $item) { $itemStr = is_object($item) ? json_encode($item) : (string)$item; if (stripos($itemStr, "pdf") !== false) { $found = true; } } $this->assertTrue($found, 'expected array to contain string'); } }