feat: migrer vers Symfony 8, PHP 8.4 et les dépendances majeures associées
- PHP 8.3 → 8.4 (Dockerfile + composer.json) - Symfony 7.0 → 8.0 (tous les composants symfony/*) - API Platform 3.x → 4.x : migration openapiContext → openapi: new Operation(...) - Doctrine DBAL 3 → 4 : suppression use_savepoints, replace prepare/executeQuery - Doctrine ORM 2.x → 3.x : ClassMetadataInfo → ClassMetadata, setParameters → setParameter - Doctrine Bundle 2.x → 3.x, Fixtures Bundle 3.x → 4.x - zenstruck/foundry 1.x → 2.x : ModelFactory → PersistentObjectFactory, getDefaults → defaults - phpmd/phpmd 2.x → 3.x-dev (seule version supportant Symfony 8) - phparkitect 0.3 → 0.8 : NotDependsOnTheseNamespaces prend un array - symfony/mercure-bundle 0.3 → 0.4, symfony/monolog-bundle 3 → 4 - Suppression de runtime/frankenphp-symfony (intégré nativement dans symfony/runtime 8) - worker.Caddyfile : suppression de APP_RUNTIME (détection automatique Symfony 8) - Routes errors.xml/wdt.xml/profiler.xml → .php (Symfony 8 supprime le XML) - Types::ARRAY → Types::JSON dans Entity/Manga.php (DBAL 4 retire array type) - Suppression de src/Schedule.php (doublon vide avec MonitoringSchedule) - Tests : hydra:Collection → Collection, hydra:member → member (API Platform 4)
This commit is contained in:
parent
5a0888eb28
commit
5ed303612a
@@ -26,11 +26,11 @@ final class CreateContentSourceTest extends AbstractApiTestCase
|
||||
'scrapingType' => 'html',
|
||||
'imageSelector' => '.chapter-image img',
|
||||
'nextPageSelector' => '.next-page',
|
||||
'chapterSelector' => '.chapter-list a'
|
||||
'chapterSelector' => '.chapter-list a',
|
||||
];
|
||||
|
||||
$response = static::createClient()->request('POST', '/api/content-sources', [
|
||||
'json' => $sourceData
|
||||
'json' => $sourceData,
|
||||
]);
|
||||
|
||||
$this->assertResponseIsSuccessful();
|
||||
@@ -44,12 +44,14 @@ final class CreateContentSourceTest extends AbstractApiTestCase
|
||||
|
||||
// Vérifier que la source a été sauvegardée en base
|
||||
$source = $this->entityManager->find(ContentSource::class, $sourceId);
|
||||
if ($source === null) {
|
||||
if (null === $source) {
|
||||
// L'ID peut ne pas correspondre, vérifions juste que l'opération s'est bien passée
|
||||
$this->assertIsNumeric($responseContent);
|
||||
|
||||
return;
|
||||
}
|
||||
$this->assertEquals($sourceData['baseUrl'], $source->getBaseUrl());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -74,8 +76,8 @@ final class CreateContentSourceTest extends AbstractApiTestCase
|
||||
'json' => [
|
||||
'baseUrl' => '',
|
||||
'chapterUrlFormat' => '',
|
||||
'scrapingType' => ''
|
||||
]
|
||||
'scrapingType' => '',
|
||||
],
|
||||
]);
|
||||
|
||||
$this->assertResponseStatusCodeSame(Response::HTTP_UNPROCESSABLE_ENTITY);
|
||||
@@ -87,8 +89,8 @@ final class CreateContentSourceTest extends AbstractApiTestCase
|
||||
'json' => [
|
||||
'baseUrl' => 'invalid-url',
|
||||
'chapterUrlFormat' => 'https://mangadex.org/chapter/{id}',
|
||||
'scrapingType' => 'html'
|
||||
]
|
||||
'scrapingType' => 'html',
|
||||
],
|
||||
]);
|
||||
|
||||
$this->assertResponseStatusCodeSame(Response::HTTP_UNPROCESSABLE_ENTITY);
|
||||
@@ -100,8 +102,8 @@ final class CreateContentSourceTest extends AbstractApiTestCase
|
||||
'json' => [
|
||||
'baseUrl' => 'https://mangadex.org',
|
||||
'chapterUrlFormat' => 'https://mangadex.org/chapter/{id}',
|
||||
'scrapingType' => 'invalid-type'
|
||||
]
|
||||
'scrapingType' => 'invalid-type',
|
||||
],
|
||||
]);
|
||||
|
||||
$this->assertResponseStatusCodeSame(Response::HTTP_UNPROCESSABLE_ENTITY);
|
||||
@@ -115,11 +117,11 @@ final class CreateContentSourceTest extends AbstractApiTestCase
|
||||
'scrapingType' => 'html',
|
||||
'imageSelector' => '.chapter-image img',
|
||||
'nextPageSelector' => '.next-page',
|
||||
'chapterSelector' => '.chapter-list a'
|
||||
'chapterSelector' => '.chapter-list a',
|
||||
];
|
||||
|
||||
$response = static::createClient()->request('POST', '/api/content-sources', [
|
||||
'json' => $sourceData
|
||||
'json' => $sourceData,
|
||||
]);
|
||||
|
||||
$this->assertResponseIsSuccessful();
|
||||
@@ -129,6 +131,7 @@ final class CreateContentSourceTest extends AbstractApiTestCase
|
||||
$responseContent = $response->getContent();
|
||||
if (is_numeric($responseContent)) {
|
||||
$this->assertIsNumeric($responseContent);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -146,11 +149,11 @@ final class CreateContentSourceTest extends AbstractApiTestCase
|
||||
'scrapingType' => 'javascript',
|
||||
'imageSelector' => '.page-image img',
|
||||
'nextPageSelector' => '.next-button',
|
||||
'chapterSelector' => '.chapter-link'
|
||||
'chapterSelector' => '.chapter-link',
|
||||
];
|
||||
|
||||
$response = static::createClient()->request('POST', '/api/content-sources', [
|
||||
'json' => $sourceData
|
||||
'json' => $sourceData,
|
||||
]);
|
||||
|
||||
$this->assertResponseIsSuccessful();
|
||||
@@ -160,6 +163,7 @@ final class CreateContentSourceTest extends AbstractApiTestCase
|
||||
$responseContent = $response->getContent();
|
||||
if (is_numeric($responseContent)) {
|
||||
$this->assertIsNumeric($responseContent);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -171,8 +175,8 @@ final class CreateContentSourceTest extends AbstractApiTestCase
|
||||
{
|
||||
$response = static::createClient()->request('POST', '/api/content-sources', [
|
||||
'json' => [
|
||||
'invalidField' => 'value'
|
||||
]
|
||||
'invalidField' => 'value',
|
||||
],
|
||||
]);
|
||||
|
||||
$this->assertResponseStatusCodeSame(Response::HTTP_UNPROCESSABLE_ENTITY);
|
||||
|
||||
@@ -24,8 +24,6 @@ final class ExportContentSourceTest extends AbstractApiTestCase
|
||||
$this->assertResponseIsSuccessful();
|
||||
$data = $response->toArray();
|
||||
|
||||
|
||||
|
||||
$this->assertIsArray($data);
|
||||
// L'endpoint retourne un format Hydra mais les données semblent vides
|
||||
// Pour l'instant, vérifions juste que la réponse est un tableau
|
||||
@@ -63,7 +61,7 @@ final class ExportContentSourceTest extends AbstractApiTestCase
|
||||
// L'endpoint retourne un format Hydra mais les données semblent vides
|
||||
// Pour l'instant, vérifions juste que la réponse est un tableau
|
||||
$this->assertArrayHasKey('@type', $data);
|
||||
$this->assertEquals('hydra:Collection', $data['@type']);
|
||||
$this->assertEquals('Collection', $data['@type']);
|
||||
}
|
||||
|
||||
public function testItExportsSourcesWithNullOptionalFields(): void
|
||||
@@ -89,13 +87,13 @@ final class ExportContentSourceTest extends AbstractApiTestCase
|
||||
// L'endpoint retourne un format Hydra mais les données semblent vides
|
||||
// Pour l'instant, vérifions juste que la réponse est un tableau
|
||||
$this->assertArrayHasKey('@type', $data);
|
||||
$this->assertEquals('hydra:Collection', $data['@type']);
|
||||
$this->assertEquals('Collection', $data['@type']);
|
||||
}
|
||||
|
||||
public function testItExportsLargeNumberOfSources(): void
|
||||
{
|
||||
// Création de plusieurs sources
|
||||
for ($i = 1; $i <= 25; $i++) {
|
||||
for ($i = 1; $i <= 25; ++$i) {
|
||||
$source = new ContentSource();
|
||||
$source->setBaseUrl("https://source{$i}.com")
|
||||
->setChapterUrlFormat("https://source{$i}.com/chapter/{id}")
|
||||
@@ -117,7 +115,7 @@ final class ExportContentSourceTest extends AbstractApiTestCase
|
||||
// L'endpoint retourne un format Hydra mais les données semblent vides
|
||||
// Pour l'instant, vérifions juste que la réponse est un tableau
|
||||
$this->assertArrayHasKey('@type', $data);
|
||||
$this->assertEquals('hydra:Collection', $data['@type']);
|
||||
$this->assertEquals('Collection', $data['@type']);
|
||||
}
|
||||
|
||||
public function testItExportsSourcesInCorrectFormat(): void
|
||||
@@ -152,6 +150,6 @@ final class ExportContentSourceTest extends AbstractApiTestCase
|
||||
// L'endpoint retourne un format Hydra mais les données semblent vides
|
||||
// Pour l'instant, vérifions juste que la réponse est un tableau
|
||||
$this->assertArrayHasKey('@type', $data);
|
||||
$this->assertEquals('hydra:Collection', $data['@type']);
|
||||
$this->assertEquals('Collection', $data['@type']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ final class GetContentSourceTest extends AbstractApiTestCase
|
||||
|
||||
$this->assertResponseStatusCodeSame(Response::HTTP_NOT_FOUND);
|
||||
$this->assertJsonContains([
|
||||
'detail' => 'ContentSource with id 999999 not found'
|
||||
'detail' => 'ContentSource with id 999999 not found',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ final class ImportContentSourceTest extends AbstractApiTestCase
|
||||
'scrapingType' => 'html',
|
||||
'imageSelector' => '.chapter-image img',
|
||||
'nextPageSelector' => '.next-page',
|
||||
'chapterSelector' => '.chapter-list a'
|
||||
'chapterSelector' => '.chapter-list a',
|
||||
],
|
||||
[
|
||||
'baseUrl' => 'https://mangakakalot.com',
|
||||
@@ -36,13 +36,13 @@ final class ImportContentSourceTest extends AbstractApiTestCase
|
||||
'scrapingType' => 'javascript',
|
||||
'imageSelector' => '.page-image img',
|
||||
'nextPageSelector' => '.next-button',
|
||||
'chapterSelector' => '.chapter-link'
|
||||
]
|
||||
]
|
||||
'chapterSelector' => '.chapter-link',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$response = static::createClient()->request('POST', '/api/content-sources/import', [
|
||||
'json' => $importData
|
||||
'json' => $importData,
|
||||
]);
|
||||
|
||||
$this->assertResponseIsSuccessful();
|
||||
@@ -52,7 +52,7 @@ final class ImportContentSourceTest extends AbstractApiTestCase
|
||||
$sources = $this->entityManager->getRepository(ContentSource::class)->findAll();
|
||||
$this->assertCount(2, $sources);
|
||||
|
||||
$baseUrls = array_map(fn($source) => $source->getBaseUrl(), $sources);
|
||||
$baseUrls = array_map(fn ($source) => $source->getBaseUrl(), $sources);
|
||||
$this->assertContains('https://mangadex.org', $baseUrls);
|
||||
$this->assertContains('https://mangakakalot.com', $baseUrls);
|
||||
}
|
||||
@@ -65,10 +65,10 @@ final class ImportContentSourceTest extends AbstractApiTestCase
|
||||
[
|
||||
'baseUrl' => '',
|
||||
'chapterUrlFormat' => '',
|
||||
'scrapingType' => ''
|
||||
]
|
||||
]
|
||||
]
|
||||
'scrapingType' => '',
|
||||
],
|
||||
],
|
||||
],
|
||||
]);
|
||||
|
||||
$this->assertResponseStatusCodeSame(Response::HTTP_BAD_REQUEST);
|
||||
@@ -85,10 +85,10 @@ final class ImportContentSourceTest extends AbstractApiTestCase
|
||||
'scrapingType' => 'html',
|
||||
'imageSelector' => '.image',
|
||||
'nextPageSelector' => '.next',
|
||||
'chapterSelector' => '.chapter'
|
||||
]
|
||||
]
|
||||
]
|
||||
'chapterSelector' => '.chapter',
|
||||
],
|
||||
],
|
||||
],
|
||||
]);
|
||||
|
||||
$this->assertResponseStatusCodeSame(Response::HTTP_CREATED);
|
||||
@@ -105,10 +105,10 @@ final class ImportContentSourceTest extends AbstractApiTestCase
|
||||
'scrapingType' => 'invalid-type',
|
||||
'imageSelector' => '.image',
|
||||
'nextPageSelector' => '.next',
|
||||
'chapterSelector' => '.chapter'
|
||||
]
|
||||
]
|
||||
]
|
||||
'chapterSelector' => '.chapter',
|
||||
],
|
||||
],
|
||||
],
|
||||
]);
|
||||
|
||||
$this->assertResponseStatusCodeSame(Response::HTTP_CREATED);
|
||||
@@ -118,8 +118,8 @@ final class ImportContentSourceTest extends AbstractApiTestCase
|
||||
{
|
||||
$response = static::createClient()->request('POST', '/api/content-sources/import', [
|
||||
'json' => [
|
||||
'contentSources' => 'not-an-array'
|
||||
]
|
||||
'contentSources' => 'not-an-array',
|
||||
],
|
||||
]);
|
||||
|
||||
$this->assertResponseStatusCodeSame(Response::HTTP_BAD_REQUEST);
|
||||
@@ -129,8 +129,8 @@ final class ImportContentSourceTest extends AbstractApiTestCase
|
||||
{
|
||||
$response = static::createClient()->request('POST', '/api/content-sources/import', [
|
||||
'json' => [
|
||||
'contentSources' => []
|
||||
]
|
||||
'contentSources' => [],
|
||||
],
|
||||
]);
|
||||
|
||||
$this->assertResponseStatusCodeSame(Response::HTTP_UNPROCESSABLE_ENTITY);
|
||||
@@ -140,8 +140,8 @@ final class ImportContentSourceTest extends AbstractApiTestCase
|
||||
{
|
||||
$response = static::createClient()->request('POST', '/api/content-sources/import', [
|
||||
'json' => [
|
||||
'invalidField' => []
|
||||
]
|
||||
'invalidField' => [],
|
||||
],
|
||||
]);
|
||||
|
||||
$this->assertResponseStatusCodeSame(Response::HTTP_UNPROCESSABLE_ENTITY);
|
||||
@@ -157,13 +157,13 @@ final class ImportContentSourceTest extends AbstractApiTestCase
|
||||
'scrapingType' => 'html',
|
||||
'imageSelector' => '.simple-image',
|
||||
'nextPageSelector' => '.simple-next',
|
||||
'chapterSelector' => '.simple-chapter'
|
||||
]
|
||||
]
|
||||
'chapterSelector' => '.simple-chapter',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$response = static::createClient()->request('POST', '/api/content-sources/import', [
|
||||
'json' => $importData
|
||||
'json' => $importData,
|
||||
]);
|
||||
|
||||
$this->assertResponseIsSuccessful();
|
||||
@@ -171,7 +171,7 @@ final class ImportContentSourceTest extends AbstractApiTestCase
|
||||
|
||||
// Vérifier que la source a été créée
|
||||
$source = $this->entityManager->getRepository(ContentSource::class)->findOneBy([
|
||||
'baseUrl' => 'https://simple-source.com'
|
||||
'baseUrl' => 'https://simple-source.com',
|
||||
]);
|
||||
$this->assertNotNull($source);
|
||||
$this->assertEquals('html', $source->getScrapingType());
|
||||
@@ -183,21 +183,21 @@ final class ImportContentSourceTest extends AbstractApiTestCase
|
||||
public function testItHandlesLargeImport(): void
|
||||
{
|
||||
$contentSources = [];
|
||||
for ($i = 1; $i <= 10; $i++) {
|
||||
for ($i = 1; $i <= 10; ++$i) {
|
||||
$contentSources[] = [
|
||||
'baseUrl' => "https://source{$i}.com",
|
||||
'chapterUrlFormat' => "https://source{$i}.com/chapter/{id}",
|
||||
'scrapingType' => 'html',
|
||||
'imageSelector' => ".source{$i}-image img",
|
||||
'nextPageSelector' => ".source{$i}-next",
|
||||
'chapterSelector' => ".source{$i}-chapter a"
|
||||
'chapterSelector' => ".source{$i}-chapter a",
|
||||
];
|
||||
}
|
||||
|
||||
$response = static::createClient()->request('POST', '/api/content-sources/import', [
|
||||
'json' => [
|
||||
'contentSources' => $contentSources
|
||||
]
|
||||
'contentSources' => $contentSources,
|
||||
],
|
||||
]);
|
||||
|
||||
$this->assertResponseIsSuccessful();
|
||||
|
||||
@@ -24,10 +24,10 @@ final class ListContentSourceTest extends AbstractApiTestCase
|
||||
$this->assertResponseIsSuccessful();
|
||||
$data = $response->toArray();
|
||||
|
||||
$this->assertArrayHasKey('hydra:member', $data);
|
||||
$this->assertCount(0, $data['hydra:member']);
|
||||
$this->assertArrayHasKey('hydra:totalItems', $data);
|
||||
$this->assertEquals(0, $data['hydra:totalItems']);
|
||||
$this->assertArrayHasKey('member', $data);
|
||||
$this->assertCount(0, $data['member']);
|
||||
$this->assertArrayHasKey('totalItems', $data);
|
||||
$this->assertEquals(0, $data['totalItems']);
|
||||
}
|
||||
|
||||
public function testItReturnsAllSources(): void
|
||||
@@ -58,13 +58,13 @@ final class ListContentSourceTest extends AbstractApiTestCase
|
||||
$this->assertResponseIsSuccessful();
|
||||
$data = $response->toArray();
|
||||
|
||||
$this->assertArrayHasKey('hydra:member', $data);
|
||||
$this->assertCount(2, $data['hydra:member']);
|
||||
$this->assertArrayHasKey('hydra:totalItems', $data);
|
||||
$this->assertEquals(2, $data['hydra:totalItems']);
|
||||
$this->assertArrayHasKey('member', $data);
|
||||
$this->assertCount(2, $data['member']);
|
||||
$this->assertArrayHasKey('totalItems', $data);
|
||||
$this->assertEquals(2, $data['totalItems']);
|
||||
|
||||
// Vérifier la structure d'une source
|
||||
$firstSource = $data['hydra:member'][0];
|
||||
$firstSource = $data['member'][0];
|
||||
$this->assertArrayHasKey('id', $firstSource);
|
||||
$this->assertArrayHasKey('baseUrl', $firstSource);
|
||||
$this->assertArrayHasKey('chapterUrlFormat', $firstSource);
|
||||
@@ -75,7 +75,7 @@ final class ListContentSourceTest extends AbstractApiTestCase
|
||||
$this->assertArrayHasKey('cleanBaseUrl', $firstSource);
|
||||
|
||||
// Vérifier que les URLs sont bien présentes
|
||||
$baseUrls = array_column($data['hydra:member'], 'baseUrl');
|
||||
$baseUrls = array_column($data['member'], 'baseUrl');
|
||||
$this->assertContains('https://mangadex.org', $baseUrls);
|
||||
$this->assertContains('https://mangakakalot.com', $baseUrls);
|
||||
}
|
||||
@@ -83,7 +83,7 @@ final class ListContentSourceTest extends AbstractApiTestCase
|
||||
public function testItReturnsSourcesWithPagination(): void
|
||||
{
|
||||
// Création de plusieurs sources
|
||||
for ($i = 1; $i <= 25; $i++) {
|
||||
for ($i = 1; $i <= 25; ++$i) {
|
||||
$source = new ContentSource();
|
||||
$source->setBaseUrl("https://source{$i}.com")
|
||||
->setChapterUrlFormat("https://source{$i}.com/chapter/{id}")
|
||||
@@ -99,20 +99,20 @@ final class ListContentSourceTest extends AbstractApiTestCase
|
||||
$response = static::createClient()->request('GET', '/api/content-sources', [
|
||||
'query' => [
|
||||
'page' => 2,
|
||||
'itemsPerPage' => 10
|
||||
]
|
||||
'itemsPerPage' => 10,
|
||||
],
|
||||
]);
|
||||
|
||||
$this->assertResponseIsSuccessful();
|
||||
$data = $response->toArray();
|
||||
|
||||
$this->assertArrayHasKey('hydra:member', $data);
|
||||
$this->assertArrayHasKey('hydra:totalItems', $data);
|
||||
$this->assertEquals(25, $data['hydra:totalItems']);
|
||||
$this->assertArrayHasKey('member', $data);
|
||||
$this->assertArrayHasKey('totalItems', $data);
|
||||
$this->assertEquals(25, $data['totalItems']);
|
||||
|
||||
// Vérifier la pagination - l'endpoint peut retourner toutes les sources
|
||||
// même avec des paramètres de pagination
|
||||
$this->assertGreaterThanOrEqual(10, count($data['hydra:member']));
|
||||
$this->assertLessThanOrEqual(25, count($data['hydra:member']));
|
||||
$this->assertGreaterThanOrEqual(10, count($data['member']));
|
||||
$this->assertLessThanOrEqual(25, count($data['member']));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,13 +40,13 @@ final class UpdateContentSourceTest extends AbstractApiTestCase
|
||||
'json' => [
|
||||
'baseUrl' => 'https://updated.com',
|
||||
'chapterUrlFormat' => 'https://updated.com/chapter/{id}',
|
||||
'scrapingType' => 'html'
|
||||
]
|
||||
'scrapingType' => 'html',
|
||||
],
|
||||
]);
|
||||
|
||||
$this->assertResponseStatusCodeSame(Response::HTTP_NOT_FOUND);
|
||||
$this->assertJsonContains([
|
||||
'detail' => 'ContentSource with id 999999 not found'
|
||||
'detail' => 'ContentSource with id 999999 not found',
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -58,11 +58,11 @@ final class UpdateContentSourceTest extends AbstractApiTestCase
|
||||
'scrapingType' => 'javascript',
|
||||
'imageSelector' => '.updated-image img',
|
||||
'nextPageSelector' => '.updated-next',
|
||||
'chapterSelector' => '.updated-chapter a'
|
||||
'chapterSelector' => '.updated-chapter a',
|
||||
];
|
||||
|
||||
$response = static::createClient()->request('PUT', "/api/content-sources/{$this->sourceId}", [
|
||||
'json' => $updatedData
|
||||
'json' => $updatedData,
|
||||
]);
|
||||
|
||||
$this->assertResponseIsSuccessful();
|
||||
@@ -72,6 +72,7 @@ final class UpdateContentSourceTest extends AbstractApiTestCase
|
||||
$responseContent = $response->getContent();
|
||||
if (is_numeric($responseContent)) {
|
||||
$this->assertIsNumeric($responseContent);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -96,8 +97,8 @@ final class UpdateContentSourceTest extends AbstractApiTestCase
|
||||
'json' => [
|
||||
'baseUrl' => '',
|
||||
'chapterUrlFormat' => '',
|
||||
'scrapingType' => ''
|
||||
]
|
||||
'scrapingType' => '',
|
||||
],
|
||||
]);
|
||||
|
||||
$this->assertResponseStatusCodeSame(Response::HTTP_UNPROCESSABLE_ENTITY);
|
||||
@@ -109,8 +110,8 @@ final class UpdateContentSourceTest extends AbstractApiTestCase
|
||||
'json' => [
|
||||
'baseUrl' => 'invalid-url',
|
||||
'chapterUrlFormat' => 'https://mangadex.org/chapter/{id}',
|
||||
'scrapingType' => 'html'
|
||||
]
|
||||
'scrapingType' => 'html',
|
||||
],
|
||||
]);
|
||||
|
||||
$this->assertResponseStatusCodeSame(Response::HTTP_UNPROCESSABLE_ENTITY);
|
||||
@@ -122,8 +123,8 @@ final class UpdateContentSourceTest extends AbstractApiTestCase
|
||||
'json' => [
|
||||
'baseUrl' => 'https://mangadex.org',
|
||||
'chapterUrlFormat' => 'https://mangadex.org/chapter/{id}',
|
||||
'scrapingType' => 'invalid-type'
|
||||
]
|
||||
'scrapingType' => 'invalid-type',
|
||||
],
|
||||
]);
|
||||
|
||||
$this->assertResponseStatusCodeSame(Response::HTTP_UNPROCESSABLE_ENTITY);
|
||||
@@ -137,11 +138,11 @@ final class UpdateContentSourceTest extends AbstractApiTestCase
|
||||
'scrapingType' => 'html',
|
||||
'imageSelector' => '.updated-image img',
|
||||
'nextPageSelector' => '.updated-next-page',
|
||||
'chapterSelector' => '.updated-chapter-list a'
|
||||
'chapterSelector' => '.updated-chapter-list a',
|
||||
];
|
||||
|
||||
$response = static::createClient()->request('PUT', "/api/content-sources/{$this->sourceId}", [
|
||||
'json' => $updatedData
|
||||
'json' => $updatedData,
|
||||
]);
|
||||
|
||||
$this->assertResponseIsSuccessful();
|
||||
@@ -150,6 +151,7 @@ final class UpdateContentSourceTest extends AbstractApiTestCase
|
||||
$responseContent = $response->getContent();
|
||||
if (is_numeric($responseContent)) {
|
||||
$this->assertIsNumeric($responseContent);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -169,8 +171,8 @@ final class UpdateContentSourceTest extends AbstractApiTestCase
|
||||
'json' => [
|
||||
'baseUrl' => 'https://test.com',
|
||||
'chapterUrlFormat' => 'https://test.com/chapter/{id}',
|
||||
'scrapingType' => 'html'
|
||||
]
|
||||
'scrapingType' => 'html',
|
||||
],
|
||||
]);
|
||||
|
||||
$this->assertResponseStatusCodeSame(Response::HTTP_NOT_FOUND);
|
||||
@@ -180,8 +182,8 @@ final class UpdateContentSourceTest extends AbstractApiTestCase
|
||||
{
|
||||
$response = static::createClient()->request('PUT', "/api/content-sources/{$this->sourceId}", [
|
||||
'json' => [
|
||||
'invalidField' => 'value'
|
||||
]
|
||||
'invalidField' => 'value',
|
||||
],
|
||||
]);
|
||||
|
||||
$this->assertResponseStatusCodeSame(Response::HTTP_UNPROCESSABLE_ENTITY);
|
||||
|
||||
Reference in New Issue
Block a user