From cb5a38da9304104bc7ea3b716a13f6b120e2bf9b Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Mon, 11 Nov 2024 07:28:52 +0100 Subject: [PATCH] WIP|Shorten slugs Slugs might sometimes become too long. This should be handled, but we do not know how right now. This is already a test setup for validating the logic. Relates: #11496 --- .../Assertions/ImportsWithTooLongSlug.php | 20 +++++++ .../Fixtures/ResponseWithTooLongSlug.json | 58 +++++++++++++++++++ .../ImportsExampleAsExpectedTest.php | 14 +++++ 3 files changed, 92 insertions(+) create mode 100644 Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithTooLongSlug.php create mode 100644 Tests/Functional/Import/DestinationDataTest/Fixtures/ResponseWithTooLongSlug.json diff --git a/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithTooLongSlug.php b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithTooLongSlug.php new file mode 100644 index 0000000..f06a68e --- /dev/null +++ b/Tests/Functional/Import/DestinationDataTest/Assertions/ImportsWithTooLongSlug.php @@ -0,0 +1,20 @@ + [ + [ + 'uid' => 1, + 'global_id' => 'e_100347854', + 'slug' => 'kann-man-noch-guten-gewissens-kinder', + ], + ], + 'tx_events_domain_model_date' => [ + [ + 'uid' => 1, + 'event' => '1', + 'slug' => 'kann-man-noch-guten-gewissens-kinder-2099-12-19t14-00-00', + ], + ], +]; diff --git a/Tests/Functional/Import/DestinationDataTest/Fixtures/ResponseWithTooLongSlug.json b/Tests/Functional/Import/DestinationDataTest/Fixtures/ResponseWithTooLongSlug.json new file mode 100644 index 0000000..64b0c48 --- /dev/null +++ b/Tests/Functional/Import/DestinationDataTest/Fixtures/ResponseWithTooLongSlug.json @@ -0,0 +1,58 @@ +{ + "status": "OK", + "count": 1, + "overallcount": 1, + "channels": [], + "facetGroups": [], + "items": [ + { + "global_id": "e_100347854", + "id": "100347854", + "title": "Kann man noch guten Gewissens Kinder bekommen? Ein Arzt hat sich von seiner Frau getrennt, weil diese ein Kind mit ihm haben wollte – seiner Meinung nach unverantwortlich in einer Welt, die durch den weit fortgeschrittenen Klimawandel dem Untergang ge …", + "type": "Event", + "categories": [ + ], + "texts": [ + ], + "country": "Deutschland", + "areas": [ + "Rudolstadt und Umgebung" + ], + "city": "Rudolstadt", + "zip": "07407", + "street": "Schillerstraße 25", + "phone": "+ 49 3672 / 486470", + "fax": "+ 49 3672 / 486475", + "web": "http://www.schillerhaus.rudolstadt.de/", + "email": "schillerhaus@rudolstadt.de", + "author": "support@hubermedia.de", + "media_objects": [ + ], + "keywords": [ + ], + "timeIntervals": [ + { + "weekdays": [], + "start": "2099-12-19T15:00:00+01:00", + "end": "2099-12-19T16:30:00+01:00", + "tz": "Europe/Berlin", + "interval": 1 + } + ], + "name": "Schillerhaus Rudolstadt", + "features": [ + ], + "addresses": [ + ], + "created": "2099-10-31T12:29:00+00:00", + "changed": "2099-12-14T08:29:00+00:00", + "company": "", + "district": "", + "postoffice": "", + "phone2": "", + "seasons": [], + "subitems": [], + "hyperObjects": [] + } + ] +} diff --git a/Tests/Functional/Import/DestinationDataTest/ImportsExampleAsExpectedTest.php b/Tests/Functional/Import/DestinationDataTest/ImportsExampleAsExpectedTest.php index 5871c3d..5047930 100644 --- a/Tests/Functional/Import/DestinationDataTest/ImportsExampleAsExpectedTest.php +++ b/Tests/Functional/Import/DestinationDataTest/ImportsExampleAsExpectedTest.php @@ -94,4 +94,18 @@ class ImportsExampleAsExpectedTest extends AbstractTestCase $this->assertPHPDataSet(__DIR__ . '/Assertions/ImportsKeywords.php'); $this->assertEmptyLog(); } + + #[Test] + public function importsWithTooLongSlug(): void + { + $this->importPHPDataSet(__DIR__ . '/Fixtures/Database/DefaultImportConfiguration.php'); + $this->setUpResponses([ + new Response(200, [], file_get_contents(__DIR__ . '/Fixtures/ResponseWithTooLongSlug.json') ?: ''), + ]); + + $this->executeCommand(); + + $this->assertPHPDataSet(__DIR__ . '/Assertions/ImportsWithTooLongSlug.php'); + $this->assertEmptyLog(); + } }