From 89a1428ca071249dff4f370561c45ba6013aaced Mon Sep 17 00:00:00 2001 From: hamed <15238-genius.ha@users.noreply.drupalcode.org> Date: Sun, 9 Aug 2026 07:22:31 +0330 Subject: [PATCH] feat(tests): update topic slug generation for blog identifier resolution tests --- tests/Blog/BlogIdentifierResolutionTest.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/Blog/BlogIdentifierResolutionTest.php b/tests/Blog/BlogIdentifierResolutionTest.php index e46928cd..7557a87b 100644 --- a/tests/Blog/BlogIdentifierResolutionTest.php +++ b/tests/Blog/BlogIdentifierResolutionTest.php @@ -53,10 +53,13 @@ class BlogIdentifierResolutionTest extends ApiTestCase public function testResolvesByTopicSlug(): void { $blog = $this->makePublished('راهنمای تشخیص آلرژی دارویی'); - $blog->setTopicSlug('allergy-immunology-symptoms-901'); + // یکتا به‌ازای هر اجرا: topic_slug ستون unique است و دیتابیس تست بین + // اجراها پاک نمی‌شود. + $topicSlug = 'topic-' . substr($blog->getUuid(), 0, 8); + $blog->setTopicSlug($topicSlug); $this->em->flush(); - $body = $this->fetch('allergy-immunology-symptoms-901'); + $body = $this->fetch($topicSlug); $this->assertSame(200, $this->responseCode()); $this->assertSame($blog->getSlug(), $body['data']['data']['slug']); @@ -96,11 +99,11 @@ class BlogIdentifierResolutionTest extends ApiTestCase public function testDraftStaysHiddenEvenThroughFallbackIdentifiers(): void { $blog = new Blog($this->createUser(['ROLE_ADMIN']), 'پیش‌نویس منتشرنشده', 'متن آزمایشی مقاله برای تست'); - $blog->setTopicSlug('draft-topic-901'); + $blog->setTopicSlug('draft-topic-' . bin2hex(random_bytes(4))); $this->em->persist($blog); $this->em->flush(); - $this->fetch('draft-topic-901'); + $this->fetch($blog->getTopicSlug()); $this->assertSame(404, $this->responseCode()); $this->fetch($blog->getUuid());