Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 5.2: update changelog [MediaBundle][SearchBundle] Provide default config for bundles to work on sf4 (#2365) [GeneratorBundle] Use new multi language parameter as the check is broken on empty install (#2359) [PagePartBundle] Make sure column names are independent of the doctrine naming strategy (#2358) [AdminBundle] added SimpleMenuAdaptorTest (#2361) [GeneratorBundle] Fixed not supported template naming for SF34 (#2363)
- Loading branch information
Showing
57 changed files
with
178 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 105 additions & 0 deletions
105
src/Kunstmaan/AdminBundle/Tests/unit/Helper/Menu/SimpleMenuAdaptorTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
<?php | ||
|
||
namespace Kunstmaan\AdminBundle\Tests\Helper\Menu; | ||
|
||
use Kunstmaan\AdminBundle\Helper\Menu\MenuAdaptorInterface; | ||
use Kunstmaan\AdminBundle\Helper\Menu\MenuBuilder; | ||
use Kunstmaan\AdminBundle\Helper\Menu\SimpleMenuAdaptor; | ||
use Kunstmaan\AdminBundle\Helper\Menu\TopMenuItem; | ||
use PHPUnit\Framework\TestCase; | ||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; | ||
|
||
class SimpleMenuAdaptorTest extends TestCase | ||
{ | ||
/** @var AuthorizationCheckerInterface (mock) */ | ||
private $authorizationCheckerInterface; | ||
|
||
/** @var array */ | ||
private $menuItems; | ||
|
||
public function setUp() | ||
{ | ||
$this->authorizationCheckerInterface = $this->createMock(AuthorizationCheckerInterface::class); | ||
$this->menuItems = []; | ||
} | ||
|
||
/** | ||
* @return \PHPUnit\Framework\MockObject\MockObject|SimpleMenuAdaptor | ||
*/ | ||
public function setUpSimpleMenuAdaptorMock() | ||
{ | ||
$simpleMenuAdaptorMock = $this->getMockBuilder(SimpleMenuAdaptor::class) | ||
->setConstructorArgs([$this->authorizationCheckerInterface, $this->menuItems]) | ||
->setMethods(null) | ||
->getMock() | ||
; | ||
|
||
return $simpleMenuAdaptorMock; | ||
} | ||
|
||
/** | ||
* @dataProvider provider | ||
* | ||
* @param TopMenuItem|null $parent | ||
*/ | ||
public function testAdaptChildren(?TopMenuItem $parent, ?string $itemParent) | ||
{ | ||
$this->menuItems[] = ['parent' => 'not_test_route']; | ||
|
||
$this->menuItems[] = [ | ||
'role' => 'some_role', | ||
'parent' => $itemParent, | ||
]; | ||
|
||
$this->menuItems[] = [ | ||
'role' => 'some_role', | ||
'parent' => $itemParent, | ||
'route' => 'KunstmaanAdminBundle_menu_item', | ||
'params' => [], | ||
'label' => 'menu_item', | ||
]; | ||
|
||
$children = []; | ||
|
||
/** @var MenuBuilder $menuBuilderMock */ | ||
$menuBuilderMock = $this->createMock(MenuBuilder::class); | ||
|
||
/** @var Request $request */ | ||
$request = new Request([], [], ['_route' => 'KunstmaanAdminBundle_menu_item']); | ||
|
||
$this->authorizationCheckerInterface | ||
->expects($this->exactly(2)) | ||
->method('isGranted') | ||
->will($this->onConsecutiveCalls(false, true)) | ||
; | ||
$simpleMenuAdaptorMock = $this->setUpSimpleMenuAdaptorMock(); | ||
$simpleMenuAdaptorMock->adaptChildren($menuBuilderMock, $children, $parent, $request); | ||
|
||
$this->assertCount(1, $children); | ||
$this->assertContainsOnlyInstancesOf(TopMenuItem::class, $children); | ||
$this->assertEquals('menu_item', $children[0]->getLabel()); | ||
} | ||
|
||
public function testHasInterface() | ||
{ | ||
$simpleMenuAdaptorMock = $this->setUpSimpleMenuAdaptorMock(); | ||
$this->assertInstanceOf(MenuAdaptorInterface::class, $simpleMenuAdaptorMock); | ||
} | ||
|
||
public function provider() | ||
{ | ||
/** @var TopMenuItem $parent */ | ||
$parent = $this->createMock(TopMenuItem::class); | ||
$parent | ||
->expects($this->any()) | ||
->method('getRoute') | ||
->willReturn('test_route') | ||
; | ||
|
||
return [ | ||
'with no parent' => [null, null], | ||
'with parent' => [$parent, 'test_route'], | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../SensioGeneratorBundle/skeleton/article/Resources/views/Pages/OverviewPage/view.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...esources/SensioGeneratorBundle/skeleton/article/Resources/views/Pages/Page/view.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...esources/SensioGeneratorBundle/skeleton/defaultsite/Resources/views/Error/error.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...nsioGeneratorBundle/skeleton/defaultsite/Resources/views/Pages/ContentPage/view.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../SensioGeneratorBundle/skeleton/defaultsite/Resources/views/Pages/FormPage/view.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../SensioGeneratorBundle/skeleton/defaultsite/Resources/views/Pages/HomePage/view.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ensioGeneratorBundle/skeleton/defaultsite/Resources/views/Pages/SearchPage/view.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...orBundle/skeleton/defaultsite/app/KunstmaanSitemapBundle/views/SitemapPage/view.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...SensioGeneratorBundle/skeleton/defaultsite/app/TwigBundle/views/Exception/error.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{% extends '<% if not isV4 %><%= bundle.name %>:<% endif %>Error/error.html.twig' %} | ||
{% extends '<% if not isV4 %><%= bundle.name %>:<% endif %>Error<% if not isV4 %>:<% else %>/<% endif %>error.html.twig' %} | ||
|
||
{% set status_code = 'other' %} |
2 changes: 1 addition & 1 deletion
2
...sioGeneratorBundle/skeleton/defaultsite/app/TwigBundle/views/Exception/error404.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{% extends '<% if not isV4 %><%= bundle.name %>:<% endif %>Error/error.html.twig' %} | ||
{% extends '<% if not isV4 %><%= bundle.name %>:<% endif %>Error<% if not isV4 %>:<% else %>/<% endif %>error.html.twig' %} |
2 changes: 1 addition & 1 deletion
2
...sioGeneratorBundle/skeleton/defaultsite/app/TwigBundle/views/Exception/error500.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{% extends '<% if not isV4 %><%= bundle.name %>:<% endif %>Error/error.html.twig' %} | ||
{% extends '<% if not isV4 %><%= bundle.name %>:<% endif %>Error<% if not isV4 %>:<% else %>/<% endif %>error.html.twig' %} |
2 changes: 1 addition & 1 deletion
2
...sioGeneratorBundle/skeleton/defaultsite/app/TwigBundle/views/Exception/error503.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{% extends '<% if not isV4 %><%= bundle.name %>:<% endif %>Error/error.html.twig' %} | ||
{% extends '<% if not isV4 %><%= bundle.name %>:<% endif %>Error<% if not isV4 %>:<% else %>/<% endif %>error.html.twig' %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.