diff --git a/phpstan-baseline.php b/phpstan-baseline.php index f0b31488b..31bd1b6db 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -3727,12 +3727,6 @@ 'count' => 1, 'path' => __DIR__ . '/sources/AppBundle/Controller/Website/CompanyPublicProfile/ListAction.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#', - 'identifier' => 'foreach.nonIterable', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Website/Global/HtmlSitemapAction.php', -]; $ignoreErrors[] = [ 'message' => '#^Cannot call method getCompanyName\\(\\) on mixed\\.$#', 'identifier' => 'method.nonObject', @@ -3769,12 +3763,6 @@ 'count' => 1, 'path' => __DIR__ . '/sources/AppBundle/Controller/Website/Global/HtmlSitemapAction.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method AppBundle\\\\Controller\\\\Website\\\\Global\\\\HtmlSitemapAction\\:\\:talks\\(\\) return type has no value type specified in iterable type array\\.$#', - 'identifier' => 'missingType.iterableValue', - 'count' => 1, - 'path' => __DIR__ . '/sources/AppBundle/Controller/Website/Global/HtmlSitemapAction.php', -]; $ignoreErrors[] = [ 'message' => '#^Cannot access offset \'careers_page_url\' on mixed\\.$#', 'identifier' => 'offsetAccess.nonOffsetAccessible', diff --git a/sources/AppBundle/Controller/Website/Global/HtmlSitemapAction.php b/sources/AppBundle/Controller/Website/Global/HtmlSitemapAction.php index b9a6ee722..805dc75c0 100644 --- a/sources/AppBundle/Controller/Website/Global/HtmlSitemapAction.php +++ b/sources/AppBundle/Controller/Website/Global/HtmlSitemapAction.php @@ -7,7 +7,7 @@ use Afup\Site\Corporate\Feuille; use AppBundle\Association\Model\Repository\CompanyMemberRepository; use AppBundle\Event\Model\Repository\TalkRepository; -use AppBundle\Event\Model\Talk; +use AppBundle\Event\Talk\EventTalksSummary; use AppBundle\Site\Entity\Repository\ArticleRepository; use AppBundle\Site\Entity\Repository\FeuilleRepository; use AppBundle\Twig\ViewRenderer; @@ -31,7 +31,7 @@ public function __invoke(): Response 'association' => $this->buildPages(Feuille::ID_FEUILLE_ANTENNES), 'members' => $this->members(), 'news' => $this->news(), - 'talks' => $this->talks(), + 'summaries_by_year' => EventTalksSummary::groupByYear($this->talkRepository->getEventTalksSummaries()), ]); } @@ -89,25 +89,4 @@ private function news(): array return $news; } - - private function talks(): array - { - $talks = []; - $talkList = $this->talkRepository->getAllPastTalks(new \DateTime()->setTime(29, 59, 59)); - - /** @var Talk $talk */ - foreach ($talkList as $talk) { - $url = $this->generateUrl( - 'talks_show', - ['id' => $talk->getId(), 'slug' => $talk->getSlug()], - ); - - $talks[] = [ - 'name' => $talk->getTitle(), - 'url' => $url, - ]; - } - - return $talks; - } } diff --git a/templates/site/sitemap.html.twig b/templates/site/sitemap.html.twig index e3cfbec6d..30d2c3454 100644 --- a/templates/site/sitemap.html.twig +++ b/templates/site/sitemap.html.twig @@ -92,9 +92,15 @@
Historique des conférences - ({{ talks|length }}) - {{ _self.list(talks, true) }} + {# Les talks ne sont plus listés un par un (plus d'un millier de liens) : chaque édition + mène à sa page, qui liste ses talks, et les index donnent les autres entrées. #} + {{ _self.list([ + { name: 'Tous les talks et vidéos', url: path('talks_list') }, + { name: 'Tous les événements', url: path('talks_events') }, + { name: 'Tous les speakers', url: path('talks_speakers') }, + ]) }} + {% include 'site/talks/_events_by_year.html.twig' with { heading_level: 3 } %}
diff --git a/tests/behat/features/PublicSite/Sitemaps.feature b/tests/behat/features/PublicSite/Sitemaps.feature index ddcc6b3e6..6601c6af8 100644 --- a/tests/behat/features/PublicSite/Sitemaps.feature +++ b/tests/behat/features/PublicSite/Sitemaps.feature @@ -42,3 +42,28 @@ Feature: Site Public - Sitemaps Given I am on "/sitemap.default.xml" And the response should contain "https://apachephptest:80/" And the response should not contain "https://apachephptest:80/home" + + @reloadDbWithTestData + Scenario: Le plan du site liste les pages événement et les index, pas les talks un par un + Given I am on "/plan-du-site" + Then the response status code should be 200 + And the texts of "section#conferences a[href^='/talks/']" should be, in this order: + """ + Historique des conférences + Tous les talks et vidéos + Tous les événements + Tous les speakers + forum + Un évènement du passé + """ + And the response should contain "href=\"/talks/evenements/forum\"" + And the response should contain "href=\"/talks/evenements/passed\"" + And the response should contain "href=\"/talks/evenements/\"" + And the response should contain "href=\"/talks/speakers/\"" + And the response should not contain "href=\"/talks/1-jouons-tous-ensemble-a-un-petit-jeu\"" + And I should see "2020" in the "section#conferences section#evenements-2020 h3" element + And I should see "Le site" in the "section#pages h2" element + And I should see "Adhérer à l'AFUP" in the "section#adherer h2" element + And I should see "Association" in the "section#association h2" element + And the response should contain "href=\"/profile/company/1-mycorp\"" + And the response should contain "href=\"/news/1-les-videos-du-forum-2018-en-ligne\""