helper = $this->createMock(CrawlingHelperInterface::class); $this->action = new RobotsAction($this->helper); } /** * @test * @dataProvider provideShortCodes */ public function buildsRobotsLinesFromCrawlableShortCodes(array $shortCodes, string $expected): void { $this->helper ->expects($this->once()) ->method('listCrawlableShortCodes') ->willReturn($shortCodes); $response = $this->action->handle(ServerRequestFactory::fromGlobals()); self::assertEquals(200, $response->getStatusCode()); self::assertEquals($expected, $response->getBody()->__toString()); self::assertEquals('text/plain', $response->getHeaderLine('Content-Type')); } public function provideShortCodes(): iterable { yield 'three short codes' => [['foo', 'bar', 'baz'], << [['foo', 'bar', 'some', 'thing', 'baz'], << [[], <<