Fix dependency injected in CrawlingHelper

This commit is contained in:
Alejandro Celaya 2023-02-10 20:26:18 +01:00
parent ad44a8441a
commit 70c1c9f018
5 changed files with 51 additions and 2 deletions

View file

@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org).
## [Unreleased]
### Added
* *Nothing*
### Changed
* *Nothing*
### Deprecated
* *Nothing*
### Removed
* *Nothing*
### Fixed
* [#1698](https://github.com/shlinkio/shlink/issues/1698) Fixed error 500 in `robots.txt`.
## [3.5.1] - 2023-02-04
### Added
* *Nothing*

View file

@ -187,7 +187,7 @@ return [
Util\DoctrineBatchHelper::class,
],
Crawling\CrawlingHelper::class => ['em'],
Crawling\CrawlingHelper::class => [ShortUrl\Repository\CrawlableShortCodesQuery::class],
],
];

View file

@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace ShlinkioApiTest\Shlink\Core\Action;
use Shlinkio\Shlink\TestUtils\ApiTest\ApiTestCase;
class RobotsTest extends ApiTestCase
{
/** @test */
public function expectedListOfCrawlableShortCodesIsReturned(): void
{
$resp = $this->callShortUrl('robots.txt');
$body = $resp->getBody()->__toString();
self::assertEquals(200, $resp->getStatusCode());
self::assertEquals(
<<<ROBOTS
# For more information about the robots.txt standard, see:
# https://www.robotstxt.org/orig.html
User-agent: *
Allow: /custom
Allow: /abc123
Disallow: /
ROBOTS,
$body,
);
}
}

View file

@ -122,7 +122,7 @@ class ListShortUrlsTest extends ApiTestCase
],
'domain' => null,
'title' => null,
'crawlable' => false,
'crawlable' => true,
'forwardQuery' => false,
];
private const SHORT_URL_CUSTOM_DOMAIN = [

View file

@ -62,6 +62,7 @@ class ShortUrlsFixture extends AbstractFixture implements DependentFixtureInterf
'maxVisits' => 2,
'apiKey' => $authorApiKey,
'longUrl' => 'https://shlink.io',
'crawlable' => true,
'forwardQuery' => false,
])), '2019-01-01 00:00:20');
$manager->persist($customShortUrl);