From a9f2d689ae8b8fd3a868c15432ce2a68b987f79d Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 26 Apr 2026 16:45:07 +0200 Subject: [PATCH] 12 - Add crawler config and FetchResult value object --- app/ValueObjects/FetchResult.php | 22 ++++++++++++ tests/Unit/ValueObjects/FetchResultTest.php | 37 +++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 app/ValueObjects/FetchResult.php create mode 100644 tests/Unit/ValueObjects/FetchResultTest.php diff --git a/app/ValueObjects/FetchResult.php b/app/ValueObjects/FetchResult.php new file mode 100644 index 0000000..e8339dc --- /dev/null +++ b/app/ValueObjects/FetchResult.php @@ -0,0 +1,22 @@ +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); + } +}