Skip to content

Commit

Permalink
Merge pull request #1 from okazy/feature/seo-product-detail
Browse files Browse the repository at this point in the history
metaタグのテストの Symfony4.4 対応
  • Loading branch information
matsuoshi authored Apr 7, 2021
2 parents b0f8d15 + f48a56c commit cca46a5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/Eccube/Tests/Web/TopControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@

namespace Eccube\Tests\Web;

use Eccube\Entity\BaseInfo;
use Eccube\Entity\Page;
use Eccube\Repository\BaseInfoRepository;
use Eccube\Repository\PageRepository;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;

class TopControllerTest extends AbstractWebTestCase
{
Expand All @@ -39,11 +40,15 @@ public function testMetaTags()
{
// description を設定
$description = 'あのイーハトーヴォのすきとおった風、夏でも底に冷たさをもつ青いそら、うつくしい森で飾られたモリーオ市、郊外のぎらぎらひかる草の波。';
$page = $this->container->get(PageRepository::class)->getByUrl('homepage');
/** @var PageRepository $pageRepository */
$pageRepository = $this->entityManager->getRepository(Page::class);
$page = $pageRepository->getByUrl('homepage');
$page->setDescription($description);
$this->entityManager->flush();

$shopName = $this->container->get(BaseInfoRepository::class)->get()->getShopName();
/** @var BaseInfoRepository $baseInfoRepository */
$baseInfoRepository = $this->entityManager->getRepository(BaseInfo::class);
$shopName = $baseInfoRepository->get()->getShopName();
$expected_desc = mb_substr($description, 0, 120, 'utf-8');

$crawler = $this->client->request('GET', $this->generateUrl('homepage'));
Expand Down

0 comments on commit cca46a5

Please sign in to comment.