feat(public): add About Us page
Adds a public "درباره ما" page at /درباره-ما reusing the landing theme
(same webpack entry, header, footer, registration modal). Section ids
match the header anchors so the nav works on this page too.
The explicit route takes precedence over LandingController's catch-all
/{slug}, which is registered with priority -10.
Also links it from the header nav and footer quick links, and lists it
in sitemap.xml.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Tests\Shared;
|
||||
|
||||
use App\Shared\Controller\AboutController;
|
||||
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
/**
|
||||
* صفحهٔ «دربارهٔ ما» رندر میشود و در سایتمپ و منو دیده میشود.
|
||||
*
|
||||
* روت `/{slug}` صفحات فرود هر مسیر تکبخشی را میگیرد؛ این تست تضمین میکند
|
||||
* اسلاگ فارسیِ این صفحه به آن نیفتد و ۴۰۴ نشود.
|
||||
*/
|
||||
class AboutPageTest extends WebTestCase
|
||||
{
|
||||
private KernelBrowser $client;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->client = static::createClient();
|
||||
}
|
||||
|
||||
public function testAboutPageRenders(): void
|
||||
{
|
||||
$this->client->request('GET', '/' . AboutController::SLUG);
|
||||
$html = $this->client->getResponse()->getContent();
|
||||
|
||||
self::assertSame(200, $this->client->getResponse()->getStatusCode());
|
||||
self::assertStringContainsString('<h1 class="reveal">دربارهٔ کلینیک پرو</h1>', $html);
|
||||
self::assertStringContainsString('<title>دربارهٔ ما | کلینیک پرو</title>', $html);
|
||||
self::assertStringContainsString('شرکت توسعه فناوری اطلاعات حامی', $html);
|
||||
}
|
||||
|
||||
public function testHeaderLinksToAbout(): void
|
||||
{
|
||||
$this->client->request('GET', '/');
|
||||
|
||||
self::assertStringContainsString('href="/درباره-ما"', $this->client->getResponse()->getContent());
|
||||
}
|
||||
|
||||
public function testSitemapListsAbout(): void
|
||||
{
|
||||
$this->client->request('GET', '/sitemap.xml');
|
||||
|
||||
self::assertStringContainsString(rawurlencode(AboutController::SLUG), $this->client->getResponse()->getContent());
|
||||
}
|
||||
}
|
||||
@@ -84,9 +84,9 @@ class LandingPageTest extends WebTestCase
|
||||
$xml = $this->html('/sitemap.xml');
|
||||
$doc = new \SimpleXMLElement($xml);
|
||||
|
||||
// خانه + هر صفحهٔ فرود. عدد از خودِ رجیستری میآید تا افزودن خوشهٔ کلیدواژهٔ
|
||||
// تازه این تست را نشکند، ولی جاافتادن یک صفحه از sitemap هنوز قرمز شود.
|
||||
self::assertCount(1 + count($this->registry->all()), $doc->url);
|
||||
// خانه + دربارهٔ ما + هر صفحهٔ فرود. عدد از خودِ رجیستری میآید تا افزودن خوشهٔ
|
||||
// کلیدواژهٔ تازه این تست را نشکند، ولی جاافتادن یک صفحه از sitemap هنوز قرمز شود.
|
||||
self::assertCount(2 + count($this->registry->all()), $doc->url);
|
||||
|
||||
foreach (array_keys($this->registry->all()) as $slug) {
|
||||
self::assertStringContainsString(rawurlencode($slug), $xml, "«{$slug}» در sitemap نیست");
|
||||
|
||||
Reference in New Issue
Block a user