From 7746a1da31b871d2ca36592586e39e8054a8f066 Mon Sep 17 00:00:00 2001 From: Saeed Date: Wed, 10 May 2023 11:21:47 +0200 Subject: [PATCH] remove about page and its tests (#1772) * remove about page and its tests * remove from critical-css * More stuff * fix tests --------- Co-authored-by: Saeed Moghadamzadeh Co-authored-by: nlisgo --- app/Resources/views/about-people.html.twig | 6 - app/Resources/views/about.html.twig | 39 --- app/config/routing.yml | 30 +-- critical-css.json | 1 - src/Controller/AboutController.php | 251 +----------------- src/Controller/ArticlesController.php | 4 +- src/Controller/CommunityController.php | 2 +- src/Controller/LabsController.php | 2 +- .../AboutAimsScopeControllerTest.php | 185 ------------- test/Controller/AboutControllerTest.php | 55 ---- .../AboutPeerReviewControllerTest.php | 55 ---- ...AboutPublishingWithElifeControllerTest.php | 189 ------------- .../AboutResearchCultureControllerTest.php | 55 ---- .../AboutTechnologyControllerTest.php | 54 ---- 14 files changed, 9 insertions(+), 919 deletions(-) delete mode 100644 app/Resources/views/about.html.twig delete mode 100644 test/Controller/AboutAimsScopeControllerTest.php delete mode 100644 test/Controller/AboutControllerTest.php delete mode 100644 test/Controller/AboutPeerReviewControllerTest.php delete mode 100644 test/Controller/AboutPublishingWithElifeControllerTest.php delete mode 100644 test/Controller/AboutResearchCultureControllerTest.php delete mode 100644 test/Controller/AboutTechnologyControllerTest.php diff --git a/app/Resources/views/about-people.html.twig b/app/Resources/views/about-people.html.twig index 4c6cb3d5a..28a59b542 100644 --- a/app/Resources/views/about-people.html.twig +++ b/app/Resources/views/about-people.html.twig @@ -8,12 +8,6 @@ {{ render_pattern(contentHeader) }} -
- - {{ render_pattern(menuLink) }} - -
- {% include 'calls-to-action.html.twig' %} {% embed 'grid/listing-one-column.html.twig' with {fullWidth: true} %} diff --git a/app/Resources/views/about.html.twig b/app/Resources/views/about.html.twig deleted file mode 100644 index c47206673..000000000 --- a/app/Resources/views/about.html.twig +++ /dev/null @@ -1,39 +0,0 @@ -{% set criticalCss = 'about' %} - -{% extends '::page.html.twig' %} - -{% block title %}{{ title }}{% if title != 'About' %} | About{% endif %}{% endblock %} - -{% block body %} - - {{ render_pattern(contentHeader) }} - -
- - {{ render_pattern(menuLink) }} - -
- - {% include 'calls-to-action.html.twig' %} - - {% embed 'grid/content.html.twig' %} - - {% block main %} - - {% for part in body %} - - {{ render_pattern(part) }} - - {% endfor %} - - {% endblock %} - - {% endembed %} - -
- - {{ render_pattern(menu) }} - -
- -{% endblock %} diff --git a/app/config/routing.yml b/app/config/routing.yml index 16d617cb1..01df94360 100644 --- a/app/config/routing.yml +++ b/app/config/routing.yml @@ -21,28 +21,11 @@ home: about: path: /about - defaults: - _controller: AppBundle:About:about - -about-aims-scope: - path: /about/aims-scope - defaults: - _controller: AppBundle:About:aimsScope -about-research-culture: - path: /about/research-culture - defaults: - _controller: AppBundle:About:researchCulture - -about-technology: - path: /about/technology - defaults: - _controller: AppBundle:About:technology - -about-peer-review: - path: /about/peer-review - defaults: - _controller: AppBundle:About:peerReview +about-pubpub: + path: /about/{type} + requirements: + type: '(aims-scope|research-culture|technology|peer-review|publishing-with-elife)' about-people: path: /about/people/{type} @@ -50,11 +33,6 @@ about-people: _controller: AppBundle:About:people type: '' -about-publishing-with-elife: - path: /about/publishing-with-elife - defaults: - _controller: AppBundle:About:publishingWithElife - alerts: path: /alerts defaults: diff --git a/critical-css.json b/critical-css.json index 24253a1f9..9184232b8 100644 --- a/critical-css.json +++ b/critical-css.json @@ -1,6 +1,5 @@ { "default": "/resources", - "about": "/about", "article": "/articles/00569", "archive-month": "/archive/2016/march", "landing": "/subjects/cancer-biology", diff --git a/src/Controller/AboutController.php b/src/Controller/AboutController.php index a49676d7f..b71cadac9 100644 --- a/src/Controller/AboutController.php +++ b/src/Controller/AboutController.php @@ -12,19 +12,12 @@ use eLife\Journal\Helper\Callback; use eLife\Patterns\ViewModel\AboutProfile; use eLife\Patterns\ViewModel\AboutProfiles; -use eLife\Patterns\ViewModel\ArticleSection; use eLife\Patterns\ViewModel\Breadcrumb; use eLife\Patterns\ViewModel\Button; use eLife\Patterns\ViewModel\ContentHeader; -use eLife\Patterns\ViewModel\FlexibleViewModel; use eLife\Patterns\ViewModel\FormLabel; use eLife\Patterns\ViewModel\Link; use eLife\Patterns\ViewModel\ListHeading; -use eLife\Patterns\ViewModel\Listing; -use eLife\Patterns\ViewModel\Paragraph; -use eLife\Patterns\ViewModel\SectionListing; -use eLife\Patterns\ViewModel\SectionListingLink; -use eLife\Patterns\ViewModel\SeeMoreLink; use eLife\Patterns\ViewModel\Select; use eLife\Patterns\ViewModel\SelectNav; use eLife\Patterns\ViewModel\SelectOption; @@ -38,227 +31,6 @@ final class AboutController extends Controller { const FOUNDING_EDITOR_IN_CHIEF_ID = '6d42f4fe'; - public function aboutAction(Request $request) : Response - { - $arguments = $this->aboutPageArguments($request); - - $arguments['title'] = 'About'; - - $arguments['contentHeader'] = new ContentHeader('eLife: evolution of publishing', null, - 'Independent, not-for-profit and supported by funders, eLife improves the way research is practised and shared.'); - - $arguments['body'] = [ - new Paragraph('eLife is committed to creating a future where a diverse, global community of researchers shares open results for the benefit of all.'), - new Paragraph('From the research we publish, to the tools we build, to the people we work with, we’ve earned a reputation for quality, integrity and the flexibility to bring about real change.'), - new Paragraph('We\'re committed to a "publish, review, curate" model for publishing and plan to achieve this transition by:'), - Listing::unordered([ - 'Peer reviewing preprints in the life sciences and medicine', - 'Building technology to support this model that is open-source, readily adaptable and addresses community needs', - 'Working with scientists from around the world to improve research culture', - ], 'bullet'), - new Paragraph('eLife is a non-profit organisation that receives financial support and strategic guidance from the Howard Hughes Medical Institute, the Knut and Alice Wallenberg Foundation, the Max Planck Society and Wellcome. eLife Sciences Publications Ltd is publisher of the open-access eLife journal (ISSN 2050-084X).'), - ArticleSection::basic( - $this->render(Listing::unordered([ - 'Inside eLife', - 'Annual reports', - 'For the press', - 'Resources to download', - ], 'bullet')), 'Related links', 2 - ), - ]; - - return new Response($this->get('templating')->render('::about.html.twig', $arguments)); - } - - public function aimsScopeAction(Request $request) : Response - { - $arguments = $this->aboutPageArguments($request); - - $arguments['title'] = 'Aims and scope'; - - $arguments['contentHeader'] = new ContentHeader($arguments['title'], null, - 'eLife welcomes the submission of Research Articles, Short Reports, Tools and Resources articles, Research Advances, Scientific Correspondence and Review Articles in the subject areas below.'); - - $subjects = $this->get('elife.api_sdk.subjects')->reverse()->slice(0, 100); - - $arguments['body'] = (new PromiseSequence($subjects)) - ->map(function (Subject $subject) { - $body = $subject->getAimsAndScope()->map($this->willConvertTo(null, ['level' => 2])); - - $editorsLink = $this->render(new SeeMoreLink( - new Link('See editors', $this->get('router')->generate('about-people', ['type' => $subject->getId()])), - true - )); - - $lastItem = $body[$i = count($body) - 1]; - if ($body[$i = count($body) - 1] instanceof Paragraph) { - $body = $body->set($i, FlexibleViewModel::fromViewModel($lastItem) - ->withProperty('text', "{$lastItem['text']} $editorsLink")); - } else { - $body = $body->append(new Paragraph($editorsLink)); - } - - return ArticleSection::basic( - $this->render(...$body), - $subject->getName(), - 2, - $subject->getId() - ); - }) - ->then(function (Sequence $sections) { - return $sections->prepend( - new Paragraph('eLife is an open-access journal and complies with all major funding agency requirements for immediate online access to the published results of their research grants.'), - new Paragraph('For further details, and requirements for each type of submission, please consult our Author Guide.') - ); - }); - - return new Response($this->get('templating')->render('::about.html.twig', $arguments)); - } - - public function publishingWithElifeAction(Request $request) : Response - { - $arguments = $this->aboutPageArguments($request); - - $arguments['title'] = 'Publishing with eLife'; - - $arguments['contentHeader'] = new ContentHeader($arguments['title'], null, - 'eLife welcomes the submission of Research Articles, Short Reports, Tools and Resources articles, Research Advances, Scientific Correspondence and Review Articles in the subject areas below.'); - - $subjects = $this->get('elife.api_sdk.subjects')->reverse()->slice(0, 100); - - $arguments['body'] = (new PromiseSequence($subjects)) - ->map(function (Subject $subject) { - $body = $subject->getAimsAndScope()->map($this->willConvertTo(null, ['level' => 2])); - - $editorsLink = $this->render(new SeeMoreLink( - new Link('See editors', $this->get('router')->generate('about-people', ['type' => $subject->getId()])), - true - )); - - $lastItem = $body[$i = count($body) - 1]; - if ($body[$i = count($body) - 1] instanceof Paragraph) { - $body = $body->set($i, FlexibleViewModel::fromViewModel($lastItem) - ->withProperty('text', "{$lastItem['text']} $editorsLink")); - } else { - $body = $body->append(new Paragraph($editorsLink)); - } - - return ArticleSection::basic( - $this->render(...$body), - $subject->getName(), - 3, - $subject->getId() - ); - }) - ->then(function (Sequence $aimsAndScope) { - return [ - new Paragraph('eLife is an open-access journal, publishing high-quality research in all areas of the life sciences and medicine. It complies with all major funding agency requirements for immediate online access to the published results of their research grants.'), - new Paragraph('For further details, and requirements for each type of submission, please consult our Author Guide.'), - ArticleSection::basic( - $this->render( - ...$aimsAndScope->prepend( - new Paragraph('We welcome the submission of research in the following areas:') - ) - ), - 'Aims and Scope', - 2 - ), - ]; - }); - - return new Response($this->get('templating')->render('::about.html.twig', $arguments)); - } - - public function peerReviewAction(Request $request) : Response - { - $arguments = $this->aboutPageArguments($request); - - $arguments['title'] = 'Peer review'; - - $arguments['contentHeader'] = new ContentHeader($arguments['title'], null, - 'eLife\'s review process combines the immediacy and openness of preprints with the scrutiny of peer review by experts.'); - - $arguments['body'] = [ - new Paragraph('eLife works to improve the process of peer review so that it more effectively conveys the assessment of expert reviewers to authors, readers and other interested parties. We only peer review preprints, and are creating a system in which the outputs of peer review are the primary way research is assessed, rather than journal title. This approach brings together the immediacy and openness of a preprint with the scrutiny offered by peer review.'), - new Paragraph('eLife\'s editorial process produces two outputs:'), - Listing::ordered([ - 'Public reviews that describe the strengths and weaknesses of the work, and indicate whether the claims and conclusions are justified by the data. An evaluation summary, that captures the major conclusions of the review process, and each of the public reviews are posted alongside the preprint for the benefit of readers, potential readers, and others interested in the work.', - 'Recommendations for the authors, including requests for revisions and suggestions for improvement. The recommendations for the authors are designed to help them revise and improve their preprint. When revised preprints are accepted for publication by eLife, the recommendations for the authors and author responses are published alongside the paper.', - ], 'roman-lower'), - new Paragraph('The main features of eLife’s consultative peer-review process are:'), - Listing::unordered([ - 'we only review research papers that have been made available as preprints', - 'our editorial process produces two outputs: i) public reviews on the strengths and weaknesses of the work; ii) recommendations for the authors', - 'all decisions are made by editors who are active researchers', - 'editors and reviewers discuss their reviews with each other; extra experiments, analyses, or data collection are only requested if they are essential and can be reasonably completed within about two months', - 'manuscripts published by eLife include the recommendations to the authors and the author responses', - 'we do not artificially limit the number of articles we publish or have a set acceptance rate', - ], 'bullet'), - ArticleSection::basic( - $this->render(Listing::unordered([ - 'Preprints and peer review at eLife', - 'What we have learned about preprints', - 'Peer Review: eLife implementing "Publish, then Review" model of publishing', - ], 'bullet')), 'Related links', 2 - ), - ]; - - return new Response($this->get('templating')->render('::about.html.twig', $arguments)); - } - - public function technologyAction(Request $request) : Response - { - $arguments = $this->aboutPageArguments($request); - - $arguments['title'] = 'Technology'; - - $arguments['contentHeader'] = new ContentHeader($arguments['title'], null, - ' eLife develops and invests in technology that enhances the sharing and use of research results online.'); - - $arguments['body'] = [ - new Paragraph('eLife invests in the development of platforms that support the display, review, and organisation, dissemination and curation of content. '), - new Paragraph('From considering how to publish preprint content in an enhanced form to developing a system that supports an end-to-end workflow for reviewing preprints, our technology efforts are fully aligned with eLife’s goal to transform research communication by transitioning to a publish, review, curate model of publishing.'), - new Paragraph('An important step towards this goal is the development of Sciety, an online application for public preprint evaluation. Built by the team at eLife, Sciety brings together the latest biomedical and life science preprints that are transparently evaluated and curated by communities of experts in one convenient place.'), - new Paragraph('All software developed at eLife is open source under the most permissible of licences and can be found in our GitHub organisations for eLife GitHib and Sciety GitHub.'), - ArticleSection::basic( - $this->render(Listing::unordered([ - 'eLife Latest: Announcing a new technology direction', - 'Sciety.org', - ], 'bullet')), 'Related links', 2 - ), - ]; - - return new Response($this->get('templating')->render('::about.html.twig', $arguments)); - } - - public function researchCultureAction(Request $request) : Response - { - $arguments = $this->aboutPageArguments($request); - - $arguments['title'] = 'Research culture'; - - $arguments['contentHeader'] = new ContentHeader($arguments['title'], null, - 'eLife recognises that reforming research communication depends on improving research culture.'); - - $arguments['body'] = [ - new Paragraph('eLife has an ambitious agenda to reform how research is communicated and assessed, and works to promote a research culture that centres on openness, integrity, and equity, diversity and inclusion. Supported by our Communities team, we engage closely with researchers across biology and medicine to drive this change. Updates on many of these activities can be found on our Community page.'), - new Paragraph('In parallel, eLife publishes articles on research culture and equity, diversity and inclusion, and provides a platform for the research community to discuss relevant issues through personal stories, interviews, podcasts and webinars.'), - new Paragraph('eLife is deeply committed to helping make research and publishing more equitable and inclusive, and we regularly report on our actions in these areas.'), - new Paragraph('With the guidance of our Early-Career Advisory Group, eLife has created peer networks through the eLife Community Ambassadors program, supported researchers from underrepresented backgrounds and countries with limited funding, and increased the involvement of early-career researchers in peer review.'), - new Paragraph('eLife was a founder ­– and continues to be a supporter – of the San Francisco Declaration on Research Assessment (DORA).'), - ArticleSection::basic( - $this->render(Listing::unordered([ - 'Community page', - 'ecrLife', - 'Follow eLife Community on Twitter', - 'Sign up for our early-career researchers newsletter', - ], 'bullet')), 'Related links', 2 - ), - ]; - - return new Response($this->get('templating')->render('::about.html.twig', $arguments)); - } - public function peopleAction(Request $request, string $type) : Response { if ($request->query->has('type')) { @@ -412,27 +184,6 @@ private function createAboutProfiles(Sequence $people, string $heading, bool $co private function aboutPageArguments(Request $request) : array { - $arguments = $this->defaultPageArguments($request); - - $arguments['menuLink'] = new SectionListingLink('All sections', 'sections'); - - $menuItems = [ - 'About eLife' => $this->get('router')->generate('about'), - 'Publishing with eLife' => $this->get('router')->generate('about-publishing-with-elife'), - 'Editors and people' => $this->get('router')->generate('about-people'), - 'Peer review' => $this->get('router')->generate('about-peer-review'), - 'Technology' => $this->get('router')->generate('about-technology'), - 'Research Culture' => $this->get('router')->generate('about-research-culture'), - ]; - - $currentPath = $this->get('router')->generate($request->attributes->get('_route'), $request->attributes->get('_route_params')); - - $menuItems = array_map(function (string $text, string $path) use ($currentPath) { - return new Link($text, $path, null, $path === $currentPath); - }, array_keys($menuItems), array_values($menuItems)); - - $arguments['menu'] = new SectionListing('sections', $menuItems, new ListHeading('About sections'), true); - - return $arguments; + return $this->defaultPageArguments($request); } } diff --git a/src/Controller/ArticlesController.php b/src/Controller/ArticlesController.php index b537b8c4b..426bf0e77 100644 --- a/src/Controller/ArticlesController.php +++ b/src/Controller/ArticlesController.php @@ -314,7 +314,7 @@ private function createFirstPage(Request $request, string $id, array $arguments) $first = true; $relatedLinks = []; - $relatedLinks[] = new Link('About eLife assessments', $this->get('router')->generate('about-peer-review')); + $relatedLinks[] = new Link('About eLife assessments', $this->get('router')->generate('about-pubpub', ['type'=> 'peer-review'])); $parts[] = ArticleSection::collapsible( 'elife-assessment', @@ -344,7 +344,7 @@ private function createFirstPage(Request $request, string $id, array $arguments) $relatedLinks[] = new Link('Reviews on Sciety', $item->getEditorEvaluationScietyUri()); } - $relatedLinks[] = new Link('eLife\'s review process', $this->get('router')->generate('about-peer-review')); + $relatedLinks[] = new Link('eLife\'s review process', $this->get('router')->generate('about-pubpub', ['type'=> 'peer-review'])); $parts[] = ArticleSection::collapsible( $item->getEditorEvaluation()->getId() ?? 'editor-evaluation', diff --git a/src/Controller/CommunityController.php b/src/Controller/CommunityController.php index fb1478d91..35f8db6cc 100644 --- a/src/Controller/CommunityController.php +++ b/src/Controller/CommunityController.php @@ -56,7 +56,7 @@ private function createFirstPage(array $arguments) : Response 'Community', $this->get('elife.journal.view_model.factory.content_header_image')->forLocalFile('community'), 'The eLife community is working to help address some of the pressures on early-career scientists in a number of ways. -Learn more about our work and advisory group, sign up for our monthly news, +Learn more about our work and advisory group, sign up for our monthly news, follow us on Twitter, and explore recent activities below.' ); diff --git a/src/Controller/LabsController.php b/src/Controller/LabsController.php index 5394ff9a8..c3fb807d2 100644 --- a/src/Controller/LabsController.php +++ b/src/Controller/LabsController.php @@ -66,7 +66,7 @@ private function createFirstPage(array $arguments) : Response 'eLife Labs', $this->get('elife.journal.view_model.factory.content_header_image')->forLocalFile('labs'), 'Exploring open-source solutions at the intersection of research and technology. - Learn more about innovation at eLife, follow us on Twitter, or sign up for our technology and innovation newsletter.' + Learn more about innovation at eLife, follow us on Twitter, or sign up for our technology and innovation newsletter.' ); return new Response($this->get('templating')->render('::labs.html.twig', $arguments)); diff --git a/test/Controller/AboutAimsScopeControllerTest.php b/test/Controller/AboutAimsScopeControllerTest.php deleted file mode 100644 index 612db26f0..000000000 --- a/test/Controller/AboutAimsScopeControllerTest.php +++ /dev/null @@ -1,185 +0,0 @@ -request('GET', $this->getUrl()); - - $this->assertSame(200, $client->getResponse()->getStatusCode()); - $this->assertSame('Aims and scope', $crawler->filter('.content-header__title')->text()); - } - - /** - * @test - */ - public function it_shows_aims_and_scope_for_each_subject() - { - $client = static::createClient(); - - $this->mockApiResponse( - new Request( - 'GET', - 'http://api.elifesciences.org/subjects?page=1&per-page=100&order=asc', - ['Accept' => 'application/vnd.elife.subject-list+json; version=1'] - ), - new Response( - 200, - ['Content-Type' => 'application/vnd.elife.subject-list+json; version=1'], - json_encode([ - 'total' => 2, - 'items' => [ - [ - 'id' => 'subject1', - 'name' => 'Subject 1', - 'impactStatement' => 'Subject 1 impact statement.', - 'aimsAndScope' => [ - [ - 'type' => 'paragraph', - 'text' => 'Paragraph 1.', - ], - [ - 'type' => 'paragraph', - 'text' => 'Paragraph 2.', - ], - ], - 'image' => [ - 'banner' => [ - 'uri' => 'https://www.example.com/iiif/ban%2Fner', - 'alt' => '', - 'source' => [ - 'mediaType' => 'image/jpeg', - 'uri' => 'https://www.example.com/banner.jpg', - 'filename' => 'image.jpg', - ], - 'size' => [ - 'width' => 1800, - 'height' => 1600, - ], - ], - 'thumbnail' => [ - 'uri' => 'https://www.example.com/iiif/image', - 'alt' => '', - 'source' => [ - 'mediaType' => 'image/jpeg', - 'uri' => 'https://www.example.com/image.jpg', - 'filename' => 'image.jpg', - ], - 'size' => [ - 'width' => 800, - 'height' => 600, - ], - ], - ], - ], - [ - 'id' => 'subject2', - 'name' => 'Subject 2', - 'impactStatement' => 'Subject 2 impact statement.', - 'image' => [ - 'banner' => [ - 'uri' => 'https://www.example.com/iiif/ban%2Fner', - 'alt' => '', - 'source' => [ - 'mediaType' => 'image/jpeg', - 'uri' => 'https://www.example.com/banner.jpg', - 'filename' => 'image.jpg', - ], - 'size' => [ - 'width' => 1800, - 'height' => 1600, - ], - ], - 'thumbnail' => [ - 'uri' => 'https://www.example.com/iiif/image', - 'alt' => '', - 'source' => [ - 'mediaType' => 'image/jpeg', - 'uri' => 'https://www.example.com/image.jpg', - 'filename' => 'image.jpg', - ], - 'size' => [ - 'width' => 800, - 'height' => 600, - ], - ], - ], - ], - ], - ]) - ) - ); - - $crawler = $client->request('GET', '/about/aims-scope'); - - $this->assertSame(200, $client->getResponse()->getStatusCode()); - - $this->assertCount(2, $crawler->filter('.article-section')); - $this->assertSame('Subject 1', trim($crawler->filter('section:nth-of-type(1) .article-section__header')->text())); - $this->assertSame("Paragraph 1.\nParagraph 2. See editors", trim($crawler->filter('section:nth-of-type(1) .article-section__body')->text())); - $this->assertSame('Subject 2', trim($crawler->filter('section:nth-of-type(2) .article-section__header')->text())); - $this->assertSame('See editors', trim($crawler->filter('section:nth-of-type(2) .article-section__body')->text())); - } - - /** - * @test - */ - public function it_has_metadata() - { - $client = static::createClient(); - - $crawler = $client->request('GET', $this->getUrl().'?foo'); - - $this->assertSame(200, $client->getResponse()->getStatusCode()); - - $this->assertSame('Aims and scope | About | eLife', $crawler->filter('title')->text()); - $this->assertSame('/about/aims-scope', $crawler->filter('link[rel="canonical"]')->attr('href')); - $this->assertSame('http://localhost/about/aims-scope', $crawler->filter('meta[property="og:url"]')->attr('content')); - $this->assertSame('Aims and scope', $crawler->filter('meta[property="og:title"]')->attr('content')); - $this->assertSame('eLife welcomes the submission of Research Articles, Short Reports, Tools and Resources articles, Research Advances, Scientific Correspondence and Review Articles in the subject areas below.', $crawler->filter('meta[property="og:description"]')->attr('content')); - $this->assertSame('eLife welcomes the submission of Research Articles, Short Reports, Tools and Resources articles, Research Advances, Scientific Correspondence and Review Articles in the subject areas below.', $crawler->filter('meta[name="description"]')->attr('content')); - $this->assertSame('summary', $crawler->filter('meta[name="twitter:card"]')->attr('content')); - $this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-600x600@1.png'), '/'), $crawler->filter('meta[name="twitter:image"]')->attr('content')); - $this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-600x600@1.png'), '/'), $crawler->filter('meta[property="og:image"]')->attr('content')); - $this->assertSame('600', $crawler->filter('meta[property="og:image:width"]')->attr('content')); - $this->assertSame('600', $crawler->filter('meta[property="og:image:height"]')->attr('content')); - $this->assertEmpty($crawler->filter('meta[name="dc.identifier"]')); - $this->assertEmpty($crawler->filter('meta[name="dc.relation.ispartof"]')); - $this->assertEmpty($crawler->filter('meta[name="dc.title"]')); - $this->assertEmpty($crawler->filter('meta[name="dc.description"]')); - $this->assertEmpty($crawler->filter('meta[name="dc.date"]')); - $this->assertEmpty($crawler->filter('meta[name="dc.rights"]')); - } - - - protected function getUrl() : string - { - $this->mockApiResponse( - new Request( - 'GET', - 'http://api.elifesciences.org/subjects?page=1&per-page=100&order=asc', - ['Accept' => 'application/vnd.elife.subject-list+json; version=1'] - ), - new Response( - 200, - ['Content-Type' => 'application/vnd.elife.subject-list+json; version=1'], - json_encode([ - 'total' => 0, - 'items' => [], - ]) - ) - ); - - return '/about/aims-scope'; - } -} diff --git a/test/Controller/AboutControllerTest.php b/test/Controller/AboutControllerTest.php deleted file mode 100644 index f538ac37b..000000000 --- a/test/Controller/AboutControllerTest.php +++ /dev/null @@ -1,55 +0,0 @@ -request('GET', $this->getUrl()); - - $this->assertSame(200, $client->getResponse()->getStatusCode()); - $this->assertSame('eLife: evolution of publishing', $crawler->filter('.content-header__title')->text()); - } - - /** - * @test - */ - public function it_has_metadata() - { - $client = static::createClient(); - - $crawler = $client->request('GET', $this->getUrl().'?foo'); - - $this->assertSame(200, $client->getResponse()->getStatusCode()); - - $this->assertSame('About | eLife', $crawler->filter('title')->text()); - $this->assertSame('/about', $crawler->filter('link[rel="canonical"]')->attr('href')); - $this->assertSame('http://localhost/about', $crawler->filter('meta[property="og:url"]')->attr('content')); - $this->assertSame('About', $crawler->filter('meta[property="og:title"]')->attr('content')); - $this->assertSame('Independent, not-for-profit and supported by funders, eLife improves the way research is practised and shared.', $crawler->filter('meta[property="og:description"]')->attr('content')); - $this->assertSame('Independent, not-for-profit and supported by funders, eLife improves the way research is practised and shared.', $crawler->filter('meta[name="description"]')->attr('content')); - $this->assertSame('summary', $crawler->filter('meta[name="twitter:card"]')->attr('content')); - $this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-600x600@1.png'), '/'), $crawler->filter('meta[name="twitter:image"]')->attr('content')); - $this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-600x600@1.png'), '/'), $crawler->filter('meta[property="og:image"]')->attr('content')); - $this->assertSame('600', $crawler->filter('meta[property="og:image:width"]')->attr('content')); - $this->assertSame('600', $crawler->filter('meta[property="og:image:height"]')->attr('content')); - $this->assertEmpty($crawler->filter('meta[name="dc.identifier"]')); - $this->assertEmpty($crawler->filter('meta[name="dc.relation.ispartof"]')); - $this->assertEmpty($crawler->filter('meta[name="dc.title"]')); - $this->assertEmpty($crawler->filter('meta[name="dc.description"]')); - $this->assertEmpty($crawler->filter('meta[name="dc.date"]')); - $this->assertEmpty($crawler->filter('meta[name="dc.rights"]')); - } - - - protected function getUrl() : string - { - return '/about'; - } -} diff --git a/test/Controller/AboutPeerReviewControllerTest.php b/test/Controller/AboutPeerReviewControllerTest.php deleted file mode 100644 index 27f255d03..000000000 --- a/test/Controller/AboutPeerReviewControllerTest.php +++ /dev/null @@ -1,55 +0,0 @@ -request('GET', $this->getUrl()); - - $this->assertSame(200, $client->getResponse()->getStatusCode()); - $this->assertSame('Peer review', $crawler->filter('.content-header__title')->text()); - } - - /** - * @test - */ - public function it_has_metadata() - { - $client = static::createClient(); - - $crawler = $client->request('GET', $this->getUrl().'?foo'); - - $this->assertSame(200, $client->getResponse()->getStatusCode()); - - $this->assertSame('Peer review | About | eLife', $crawler->filter('title')->text()); - $this->assertSame('/about/peer-review', $crawler->filter('link[rel="canonical"]')->attr('href')); - $this->assertSame('http://localhost/about/peer-review', $crawler->filter('meta[property="og:url"]')->attr('content')); - $this->assertSame('Peer review', $crawler->filter('meta[property="og:title"]')->attr('content')); - $this->assertSame('eLife\'s review process combines the immediacy and openness of preprints with the scrutiny of peer review by experts.', $crawler->filter('meta[property="og:description"]')->attr('content')); - $this->assertSame('eLife\'s review process combines the immediacy and openness of preprints with the scrutiny of peer review by experts.', $crawler->filter('meta[name="description"]')->attr('content')); - $this->assertSame('summary', $crawler->filter('meta[name="twitter:card"]')->attr('content')); - $this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-600x600@1.png'), '/'), $crawler->filter('meta[name="twitter:image"]')->attr('content')); - $this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-600x600@1.png'), '/'), $crawler->filter('meta[property="og:image"]')->attr('content')); - $this->assertSame('600', $crawler->filter('meta[property="og:image:width"]')->attr('content')); - $this->assertSame('600', $crawler->filter('meta[property="og:image:height"]')->attr('content')); - $this->assertEmpty($crawler->filter('meta[name="dc.identifier"]')); - $this->assertEmpty($crawler->filter('meta[name="dc.relation.ispartof"]')); - $this->assertEmpty($crawler->filter('meta[name="dc.title"]')); - $this->assertEmpty($crawler->filter('meta[name="dc.description"]')); - $this->assertEmpty($crawler->filter('meta[name="dc.date"]')); - $this->assertEmpty($crawler->filter('meta[name="dc.rights"]')); - } - - - protected function getUrl() : string - { - return '/about/peer-review'; - } -} diff --git a/test/Controller/AboutPublishingWithElifeControllerTest.php b/test/Controller/AboutPublishingWithElifeControllerTest.php deleted file mode 100644 index 7e2fb5e50..000000000 --- a/test/Controller/AboutPublishingWithElifeControllerTest.php +++ /dev/null @@ -1,189 +0,0 @@ -request('GET', $this->getUrl()); - - $this->assertSame(200, $client->getResponse()->getStatusCode()); - $this->assertSame('Publishing with eLife', $crawler->filter('.content-header__title')->text()); - } - - /** - * @test - */ - public function it_shows_aims_and_scope_for_each_subject() - { - $client = static::createClient(); - - $this->mockApiResponse( - new Request( - 'GET', - 'http://api.elifesciences.org/subjects?page=1&per-page=100&order=asc', - ['Accept' => 'application/vnd.elife.subject-list+json; version=1'] - ), - new Response( - 200, - ['Content-Type' => 'application/vnd.elife.subject-list+json; version=1'], - json_encode([ - 'total' => 2, - 'items' => [ - [ - 'id' => 'subject1', - 'name' => 'Subject 1', - 'impactStatement' => 'Subject 1 impact statement.', - 'aimsAndScope' => [ - [ - 'type' => 'paragraph', - 'text' => 'Paragraph 1.', - ], - [ - 'type' => 'paragraph', - 'text' => 'Paragraph 2.', - ], - ], - 'image' => [ - 'banner' => [ - 'uri' => 'https://www.example.com/iiif/ban%2Fner', - 'alt' => '', - 'source' => [ - 'mediaType' => 'image/jpeg', - 'uri' => 'https://www.example.com/banner.jpg', - 'filename' => 'image.jpg', - ], - 'size' => [ - 'width' => 1800, - 'height' => 1600, - ], - ], - 'thumbnail' => [ - 'uri' => 'https://www.example.com/iiif/image', - 'alt' => '', - 'source' => [ - 'mediaType' => 'image/jpeg', - 'uri' => 'https://www.example.com/image.jpg', - 'filename' => 'image.jpg', - ], - 'size' => [ - 'width' => 800, - 'height' => 600, - ], - ], - ], - ], - [ - 'id' => 'subject2', - 'name' => 'Subject 2', - 'impactStatement' => 'Subject 2 impact statement.', - 'image' => [ - 'banner' => [ - 'uri' => 'https://www.example.com/iiif/ban%2Fner', - 'alt' => '', - 'source' => [ - 'mediaType' => 'image/jpeg', - 'uri' => 'https://www.example.com/banner.jpg', - 'filename' => 'image.jpg', - ], - 'size' => [ - 'width' => 1800, - 'height' => 1600, - ], - ], - 'thumbnail' => [ - 'uri' => 'https://www.example.com/iiif/image', - 'alt' => '', - 'source' => [ - 'mediaType' => 'image/jpeg', - 'uri' => 'https://www.example.com/image.jpg', - 'filename' => 'image.jpg', - ], - 'size' => [ - 'width' => 800, - 'height' => 600, - ], - ], - ], - ], - ], - ]) - ) - ); - - $crawler = $client->request('GET', '/about/publishing-with-elife'); - - $this->assertSame(200, $client->getResponse()->getStatusCode()); - - $aimsAndScopeSection = $crawler->filter('.article-section'); - $this->assertSame('Aims and Scope', $aimsAndScopeSection->filter('h2')->text()); - - $aimsAndScopes = $aimsAndScopeSection->filter('.article-section__body .article-section'); - - $this->assertCount(2, $aimsAndScopes); - $this->assertSame('Subject 1', $aimsAndScopes->eq(0)->filter('h3')->text()); - $this->assertSame("Paragraph 1.\nParagraph 2. See editors", trim($aimsAndScopes->eq(0)->filter('.article-section__body')->text())); - $this->assertSame('Subject 2', $aimsAndScopes->eq(1)->filter('h3')->text()); - $this->assertSame("See editors", trim($aimsAndScopes->eq(1)->filter('.article-section__body')->text())); - } - - /** - * @test - */ - public function it_has_metadata() - { - $client = static::createClient(); - - $crawler = $client->request('GET', $this->getUrl().'?foo'); - - $this->assertSame(200, $client->getResponse()->getStatusCode()); - - $this->assertSame('Publishing with eLife | About | eLife', $crawler->filter('title')->text()); - $this->assertSame('/about/publishing-with-elife', $crawler->filter('link[rel="canonical"]')->attr('href')); - $this->assertSame('http://localhost/about/publishing-with-elife', $crawler->filter('meta[property="og:url"]')->attr('content')); - $this->assertSame('Publishing with eLife', $crawler->filter('meta[property="og:title"]')->attr('content')); - $this->assertSame('eLife welcomes the submission of Research Articles, Short Reports, Tools and Resources articles, Research Advances, Scientific Correspondence and Review Articles in the subject areas below.', $crawler->filter('meta[property="og:description"]')->attr('content')); - $this->assertSame('eLife welcomes the submission of Research Articles, Short Reports, Tools and Resources articles, Research Advances, Scientific Correspondence and Review Articles in the subject areas below.', $crawler->filter('meta[name="description"]')->attr('content')); - $this->assertSame('summary', $crawler->filter('meta[name="twitter:card"]')->attr('content')); - $this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-600x600@1.png'), '/'), $crawler->filter('meta[name="twitter:image"]')->attr('content')); - $this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-600x600@1.png'), '/'), $crawler->filter('meta[property="og:image"]')->attr('content')); - $this->assertSame('600', $crawler->filter('meta[property="og:image:width"]')->attr('content')); - $this->assertSame('600', $crawler->filter('meta[property="og:image:height"]')->attr('content')); - $this->assertEmpty($crawler->filter('meta[name="dc.identifier"]')); - $this->assertEmpty($crawler->filter('meta[name="dc.relation.ispartof"]')); - $this->assertEmpty($crawler->filter('meta[name="dc.title"]')); - $this->assertEmpty($crawler->filter('meta[name="dc.description"]')); - $this->assertEmpty($crawler->filter('meta[name="dc.date"]')); - $this->assertEmpty($crawler->filter('meta[name="dc.rights"]')); - } - - protected function getUrl() : string - { - $this->mockApiResponse( - new Request( - 'GET', - 'http://api.elifesciences.org/subjects?page=1&per-page=100&order=asc', - ['Accept' => 'application/vnd.elife.subject-list+json; version=1'] - ), - new Response( - 200, - ['Content-Type' => 'application/vnd.elife.subject-list+json; version=1'], - json_encode([ - 'total' => 0, - 'items' => [], - ]) - ) - ); - - return '/about/publishing-with-elife'; - } -} diff --git a/test/Controller/AboutResearchCultureControllerTest.php b/test/Controller/AboutResearchCultureControllerTest.php deleted file mode 100644 index 716b9ae90..000000000 --- a/test/Controller/AboutResearchCultureControllerTest.php +++ /dev/null @@ -1,55 +0,0 @@ -request('GET', $this->getUrl()); - - $this->assertSame(200, $client->getResponse()->getStatusCode()); - $this->assertSame('Research culture', $crawler->filter('.content-header__title')->text()); - } - - /** - * @test - */ - public function it_has_metadata() - { - $client = static::createClient(); - - $crawler = $client->request('GET', $this->getUrl().'?foo'); - - $this->assertSame(200, $client->getResponse()->getStatusCode()); - - $this->assertSame('Research culture | About | eLife', $crawler->filter('title')->text()); - $this->assertSame('/about/research-culture', $crawler->filter('link[rel="canonical"]')->attr('href')); - $this->assertSame('http://localhost/about/research-culture', $crawler->filter('meta[property="og:url"]')->attr('content')); - $this->assertSame('Research culture', $crawler->filter('meta[property="og:title"]')->attr('content')); - $this->assertSame('eLife recognises that reforming research communication depends on improving research culture.', $crawler->filter('meta[property="og:description"]')->attr('content')); - $this->assertSame('eLife recognises that reforming research communication depends on improving research culture.', $crawler->filter('meta[name="description"]')->attr('content')); - $this->assertSame('summary', $crawler->filter('meta[name="twitter:card"]')->attr('content')); - $this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-600x600@1.png'), '/'), $crawler->filter('meta[name="twitter:image"]')->attr('content')); - $this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-600x600@1.png'), '/'), $crawler->filter('meta[property="og:image"]')->attr('content')); - $this->assertSame('600', $crawler->filter('meta[property="og:image:width"]')->attr('content')); - $this->assertSame('600', $crawler->filter('meta[property="og:image:height"]')->attr('content')); - $this->assertEmpty($crawler->filter('meta[name="dc.identifier"]')); - $this->assertEmpty($crawler->filter('meta[name="dc.relation.ispartof"]')); - $this->assertEmpty($crawler->filter('meta[name="dc.title"]')); - $this->assertEmpty($crawler->filter('meta[name="dc.description"]')); - $this->assertEmpty($crawler->filter('meta[name="dc.date"]')); - $this->assertEmpty($crawler->filter('meta[name="dc.rights"]')); - } - - - protected function getUrl() : string - { - return '/about/research-culture'; - } -} diff --git a/test/Controller/AboutTechnologyControllerTest.php b/test/Controller/AboutTechnologyControllerTest.php deleted file mode 100644 index b2bc4ee16..000000000 --- a/test/Controller/AboutTechnologyControllerTest.php +++ /dev/null @@ -1,54 +0,0 @@ -request('GET', $this->getUrl()); - - $this->assertSame(200, $client->getResponse()->getStatusCode()); - $this->assertSame('Technology', $crawler->filter('.content-header__title')->text()); - } - - /** - * @test - */ - public function it_has_metadata() - { - $client = static::createClient(); - - $crawler = $client->request('GET', $this->getUrl().'?foo'); - - $this->assertSame(200, $client->getResponse()->getStatusCode()); - - $this->assertSame('Technology | About | eLife', $crawler->filter('title')->text()); - $this->assertSame('/about/technology', $crawler->filter('link[rel="canonical"]')->attr('href')); - $this->assertSame('http://localhost/about/technology', $crawler->filter('meta[property="og:url"]')->attr('content')); - $this->assertSame('Technology', $crawler->filter('meta[property="og:title"]')->attr('content')); - $this->assertSame('eLife develops and invests in technology that enhances the sharing and use of research results online.', $crawler->filter('meta[property="og:description"]')->attr('content')); - $this->assertSame('eLife develops and invests in technology that enhances the sharing and use of research results online.', $crawler->filter('meta[name="description"]')->attr('content')); - $this->assertSame('summary', $crawler->filter('meta[name="twitter:card"]')->attr('content')); - $this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-600x600@1.png'), '/'), $crawler->filter('meta[name="twitter:image"]')->attr('content')); - $this->assertSame('http://localhost/'.ltrim(self::$kernel->getContainer()->get('elife.assets.packages')->getUrl('assets/images/social/icon-600x600@1.png'), '/'), $crawler->filter('meta[property="og:image"]')->attr('content')); - $this->assertSame('600', $crawler->filter('meta[property="og:image:width"]')->attr('content')); - $this->assertSame('600', $crawler->filter('meta[property="og:image:height"]')->attr('content')); - $this->assertEmpty($crawler->filter('meta[name="dc.identifier"]')); - $this->assertEmpty($crawler->filter('meta[name="dc.relation.ispartof"]')); - $this->assertEmpty($crawler->filter('meta[name="dc.title"]')); - $this->assertEmpty($crawler->filter('meta[name="dc.description"]')); - $this->assertEmpty($crawler->filter('meta[name="dc.date"]')); - $this->assertEmpty($crawler->filter('meta[name="dc.rights"]')); - } - - protected function getUrl() : string - { - return '/about/technology'; - } -}