diff --git a/tests/ProgramScraperTest.php b/tests/ProgramScraperTest.php index 62f1f8fb..9b1bc160 100644 --- a/tests/ProgramScraperTest.php +++ b/tests/ProgramScraperTest.php @@ -10,11 +10,11 @@ use PHPUnit\Framework\TestCase; /** - * @psalm-import-type ScrapedStadiumRaces from ScraperInterface + * @psalm-import-type ScrapedRaces from ScraperInterface * * @author shimomo */ -final class ProgramScraperTest extends Testcase +final class ProgramScraperTest extends TestCase { /** * @psalm-return void @@ -25,23 +25,29 @@ public function testScrape(): void { $mockScraper = $this->createMock(ScraperInterface::class); $mockScraper->method('scrapePrograms') - ->with(Carbon::create(2025, 7, 15)) + ->with(Carbon::create(2025, 7, 15, 0, 0, 0, 'Asia/Tokyo')) ->willReturn([ - $this->testScrapeData(1), + 1 => $this->testScrapeData(1, 5), + 2 => $this->testScrapeData(2, 6), ]); $scraper = new ProgramScraper($mockScraper); - $programs = $scraper->scrape(Carbon::create(2025, 7, 15)); - $this->assertSame($this->testScrapeData(0), $programs); + $programs = $scraper->scrape(Carbon::create(2025, 7, 15, 0, 0, 0, 'Asia/Tokyo')); + $this->assertSame(array_merge( + $this->testScrapeData(0, 0), + $this->testScrapeData(1, 0) + ), $programs); } /** * @psalm-param int $keyIndex - * @psalm-return ScrapedStadiumRaces + * @psalm-param int $boatKeyIndex + * @psalm-return ScrapedRaces * * @param int $keyIndex + * @param int $boatKeyIndex * @return array */ - private function testScrapeData(int $keyIndex): array + private function testScrapeData(int $keyIndex, int $boatKeyIndex): array { return [ $keyIndex => [ @@ -54,7 +60,7 @@ private function testScrapeData(int $keyIndex): array 'race_subtitle' => '予選', 'race_distance' => 1800, 'boats' => [ - $keyIndex => [ + $boatKeyIndex => [ 'racer_boat_number' => 1, 'racer_name' => '松本 浩貴', 'racer_number' => 3860,