Skip to content

Commit 8b33b02

Browse files
committed
fix sitemap just needed to treat it as dto
1 parent b24232b commit 8b33b02

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

app/Domains/Sources/SiteMapSource.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ public function handle(Source $source): void
3939

4040
foreach ($feedItems as $feedItem) {
4141
$webResponseDto = WebResponseDto::from([
42-
'url' => $feedItem['link'],
43-
'title' => $feedItem['title'],
44-
'description' => $feedItem['description'],
45-
'meta_data' => $feedItem,
42+
'url' => $feedItem->link,
43+
'title' => $feedItem->title,
44+
'description' => $feedItem->description,
45+
'meta_data' => $feedItem->toArray(),
4646
'profile' => [],
4747
]);
4848
$jobs[] = new GetWebContentJob($source, $webResponseDto);

tests/Feature/SiteMapSourceTest.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
namespace Tests\Feature;
44

5+
use App\Domains\Sources\FeedSource\FeedItemDto;
56
use App\Domains\Sources\SourceTypeEnum;
67
use App\Models\Source;
78
use Facades\App\Domains\Sources\SiteMapSource\SiteMapParserWrapper;
9+
use Illuminate\Support\Arr;
810
use Illuminate\Support\Facades\Bus;
911
use Tests\TestCase;
1012

@@ -17,9 +19,13 @@ public function test_run()
1719

1820
$data = get_fixture('sitemap_parsed_results.json');
1921

22+
$item = Arr::first($data);
23+
24+
$item = FeedItemDto::from($item);
25+
2026
SiteMapParserWrapper::shouldReceive('handle')
2127
->once()->andReturn(
22-
collect($data)
28+
collect([$item])
2329
);
2430

2531
$source = Source::factory()->create([

0 commit comments

Comments
 (0)