Add list of content to the homepage#64
Hidden character warning
Conversation
vendor-extra/LiberoPageBundle/src/EventListener/BuildView/ItemListListener.php
Outdated
Show resolved
Hide resolved
vendor-extra/JatsContentBundle/src/EventListener/BuildView/ItemTeaserListener.php
Outdated
Show resolved
Hide resolved
|
Since 84a4228 I am experiencing an issue with the |
| pages: | ||
| homepage: | ||
| path: '/' | ||
| primary_listing: 'scholarly-articles/items' |
There was a problem hiding this comment.
seems flexible enough to allow the different services, does it need additions to sample-configuration then?
There was a problem hiding this comment.
libero:item-list).
| $listener->onBuildView($event); | ||
| $view = $event->getView(); | ||
|
|
||
| $this->assertInstanceOf(TemplateView::class, $view); |
There was a problem hiding this comment.
I understand the negative cases but what would be a way of shortening the assertion phases of these tests? Extract a custom assertion method that contains this phase seems cheap and effective.
There was a problem hiding this comment.
this->assertEquals(new TemplateView('template'), $view); works.
There was a problem hiding this comment.
Exists in other tests too, will follow up with a refactor.
...xtra/JatsContentBundle/tests/EventListener/BuildView/FrontArticleTitleTeaserListenerTest.php
Outdated
Show resolved
Hide resolved
|
|
||
| $element = $this->loadElement( | ||
| <<<XML | ||
| <libero:front xmlns:libero="http://libero.pub"> |
There was a problem hiding this comment.
a pity that this is a completely duplicated test in another bundle, that just changes the input from JATS to libero XML.
There was a problem hiding this comment.
Might be able to do something to help these different implementations and their test suites, but definitely one for the future.
|
|
||
| $level = $view->getContext()['level'] ?? 1; | ||
| if ($view->hasContext('list_title')) { | ||
| $level++; |
There was a problem hiding this comment.
mutable counter in a long method, tricky
There was a problem hiding this comment.
Think can break this listener up.
vendor-extra/LiberoPageBundle/src/EventListener/BuildView/ItemListListener.php
Outdated
Show resolved
Hide resolved
|
|
||
| return $view->withArgument( | ||
| 'href', | ||
| $this->urlGenerator->generate("libero.page.content.{$service}", ['id' => $id]) |
There was a problem hiding this comment.
good abstraction of UrlGenerator as an application service that is passed in where needed
| private $client; | ||
| private $converter; | ||
|
|
||
| public function __construct(ClientInterface $client, ViewConverter $converter) |
There was a problem hiding this comment.
mixing the Listeners with Clients is the dangerous part in terms of layering, but I'd agree there's no other clear option here at the moment
No description provided.