assertSame(CrawlOutcomeEnum::Success, $result->outcome); $this->assertSame(200, $result->statusCode); $this->assertSame('https://example.com/article', $result->finalUrl); $this->assertSame('An Example Article', $result->title); $this->assertSame('Lorem ipsum dolor sit amet.', $result->extractedText); $this->assertInstanceOf(Collection::class, $result->outboundLinks); $this->assertSame(['https://other.com', 'https://another.com'], $result->outboundLinks->all()); $this->assertSame(5, $result->wordCount); $this->assertNull($result->errorMessage); $this->assertSame('en', $result->language); $this->assertSame(0.95, $result->languageConfidence); } public function test_it_accepts_null_for_failure_outcome_fields(): void { $result = new FetchResult( outcome: CrawlOutcomeEnum::Failed, statusCode: null, finalUrl: null, title: null, extractedText: null, outboundLinks: collect(), wordCount: null, errorMessage: 'Could not connect', language: null, languageConfidence: null, ); $this->assertSame(CrawlOutcomeEnum::Failed, $result->outcome); $this->assertNull($result->statusCode); $this->assertNull($result->finalUrl); $this->assertNull($result->title); $this->assertNull($result->extractedText); $this->assertSame([], $result->outboundLinks->all()); $this->assertNull($result->wordCount); $this->assertSame('Could not connect', $result->errorMessage); $this->assertNull($result->language); $this->assertNull($result->languageConfidence); } }