fail("failed to read fixture: text/empty.txt"); } $config = \Kreuzberg\ExtractionConfig::from_json('{}'); $this->expectNotToPerformAssertions(); $result = Kreuzberg::extractBytesSync($contentBytes, "text/plain", $config); } /** Error when extracting with empty MIME type */ public function test_error_empty_mime(): void { $this->expectException(\Exception::class); $contentBytes = file_get_contents("text/plain.txt"); if ($contentBytes === false) { $this->fail("failed to read fixture: text/plain.txt"); } $config = \Kreuzberg\ExtractionConfig::from_json('{}'); Kreuzberg::extractBytesSync($contentBytes, "", $config); } /** extract_bytes force+disable OCR */ public function test_error_extract_bytes_conflicting_ocr(): void { $this->expectException(\Exception::class); $contentBytes = file_get_contents("text/fake_text.txt"); if ($contentBytes === false) { $this->fail("failed to read fixture: text/fake_text.txt"); } $config = \Kreuzberg\ExtractionConfig::from_json(json_encode(["disableOcr" => true, "forceOcr" => true])); Kreuzberg::extractBytesSync($contentBytes, "text/plain", $config); } /** Error when extracting with invalid MIME type format */ public function test_error_invalid_mime_format(): void { $this->expectException(\Exception::class); $contentBytes = file_get_contents("text/plain.txt"); if ($contentBytes === false) { $this->fail("failed to read fixture: text/plain.txt"); } $config = \Kreuzberg\ExtractionConfig::from_json('{}'); Kreuzberg::extractBytesSync($contentBytes, "not-a-mime", $config); } /** Error when extracting with unsupported MIME type */ public function test_error_unsupported_mime(): void { $this->expectException(\Exception::class); $contentBytes = file_get_contents("text/plain.txt"); if ($contentBytes === false) { $this->fail("failed to read fixture: text/plain.txt"); } $config = \Kreuzberg\ExtractionConfig::from_json('{}'); Kreuzberg::extractBytesSync($contentBytes, "application/x-nonexistent", $config); } }