diff --git a/app/Domains/Sources/SiteMapSource.php b/app/Domains/Sources/SiteMapSource.php index 4f47a244..6a76b7e6 100644 --- a/app/Domains/Sources/SiteMapSource.php +++ b/app/Domains/Sources/SiteMapSource.php @@ -39,10 +39,10 @@ public function handle(Source $source): void foreach ($feedItems as $feedItem) { $webResponseDto = WebResponseDto::from([ - 'url' => $feedItem['link'], - 'title' => $feedItem['title'], - 'description' => $feedItem['description'], - 'meta_data' => $feedItem, + 'url' => $feedItem->link, + 'title' => $feedItem->title, + 'description' => $feedItem->description, + 'meta_data' => $feedItem->toArray(), 'profile' => [], ]); $jobs[] = new GetWebContentJob($source, $webResponseDto); diff --git a/tests/Feature/SiteMapSourceTest.php b/tests/Feature/SiteMapSourceTest.php index cdeefc3c..461cb713 100644 --- a/tests/Feature/SiteMapSourceTest.php +++ b/tests/Feature/SiteMapSourceTest.php @@ -2,9 +2,11 @@ namespace Tests\Feature; +use App\Domains\Sources\FeedSource\FeedItemDto; use App\Domains\Sources\SourceTypeEnum; use App\Models\Source; use Facades\App\Domains\Sources\SiteMapSource\SiteMapParserWrapper; +use Illuminate\Support\Arr; use Illuminate\Support\Facades\Bus; use Tests\TestCase; @@ -17,9 +19,13 @@ public function test_run() $data = get_fixture('sitemap_parsed_results.json'); + $item = Arr::first($data); + + $item = FeedItemDto::from($item); + SiteMapParserWrapper::shouldReceive('handle') ->once()->andReturn( - collect($data) + collect([$item]) ); $source = Source::factory()->create([