Skip to content

Commit

Permalink
add some unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fritzmg committed Mar 4, 2021
1 parent 01a9a39 commit c5c39ae
Showing 1 changed file with 57 additions and 0 deletions.
Expand Up @@ -246,6 +246,63 @@ public function testRendersEmptyArticlesOperationIfPageLayoutDoesNotHaveArticles
);
}

public function testRendersNoArticlesIconIfPageSupportsContentCompositionAndIconIsNull(): void
{
$this->security
->expects($this->once())
->method('isGranted')
->with('contao_user.modules', 'article')
->willReturn(true)
;

$page = $this->expectPageWithRow($this->pageRecord, 17);

$this->expectSupportsContentComposition(true, $page);

$this->imageAdapter
->expects($this->never())
->method('getHtml')
;

$this->backendAdapter
->expects($this->never())
->method('addToUrl')
;

$this->assertSame(
'',
$this->listener->renderPageArticlesOperation($this->pageRecord, '', '', '', null)
);
}

public function testRendersNoArticlesIconIfPageSupportsContentCompositionAndIconAndHrefAreNull(): void
{
$this->security
->expects($this->never())
->method('isGranted')
;

$this->imageAdapter
->expects($this->never())
->method('getHtml')
;

$this->backendAdapter
->expects($this->never())
->method('addToUrl')
;

$this->framework
->expects($this->never())
->method('createInstance')
;

$this->assertSame(
'',
$this->listener->renderPageArticlesOperation($this->pageRecord, null, '', '', null)
);
}

public function testRendersArticlesOperationIfProviderSupportsCompositionAndPageLayoutHasArticles(): void
{
$this->security
Expand Down

0 comments on commit c5c39ae

Please sign in to comment.