Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit 68ceea0

Browse files
committed
Merged fixes and fixed voter tests for 2.2 compat.
2 parents 7746983 + d3f9c88 commit 68ceea0

File tree

13 files changed

+28
-29
lines changed

13 files changed

+28
-29
lines changed

Admin/MenuAdmin.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
class MenuAdmin extends AbstractMenuNodeAdmin
1919
{
20-
protected $baseRouteName = 'cmf_menu';
21-
protected $baseRoutePattern = '/cmf/menu/menu';
2220

2321
/**
2422
* {@inheritDoc}

Admin/MenuNodeAdmin.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121

2222
class MenuNodeAdmin extends AbstractMenuNodeAdmin
2323
{
24-
protected $baseRouteName = 'cmf_menu_menunode';
25-
protected $baseRoutePattern = '/cmf/menu/menunode';
2624
protected $recursiveBreadcrumbs = true;
2725

2826
/**

Tests/Resources/Controller/CmiTestController.php renamed to Tests/Resources/Controller/VoterController.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
* Tests actions for current menu item functionality.
1313
*/
14-
class CmiTestController extends Controller
14+
class VoterController extends Controller
1515
{
1616
protected function getDm()
1717
{
@@ -20,7 +20,7 @@ protected function getDm()
2020

2121
public function defaultAction(Request $request)
2222
{
23-
return $this->render('::tests/cmi/default.html.twig');
23+
return $this->render('::tests/voter/default.html.twig');
2424
}
2525

2626
public function requestContentIdentityAction(Request $request)
@@ -30,30 +30,30 @@ public function requestContentIdentityAction(Request $request)
3030
$content = $this->getDm()->find(null, '/test/content-1');
3131
$request->attributes->set(DynamicRouter::CONTENT_KEY, $content);
3232

33-
return $this->render('::tests/cmi/requestContentVoterActive.html.twig', array('content' => $content));
33+
return $this->render('::tests/voter/requestContentVoterActive.html.twig', array('content' => $content));
3434
}
3535

36-
return $this->render('::tests/cmi/requestContent.html.twig', array('content' => $content));
36+
return $this->render('::tests/voter/requestContent.html.twig', array('content' => $content));
3737
}
3838

3939
public function blogAction(Request $request)
4040
{
41-
return $this->render('::tests/cmi/blog.html.twig');
41+
return $this->render('::tests/voter/blog.html.twig');
4242
}
4343

4444
public function articlesAction(Request $request)
4545
{
46-
return $this->render('::tests/cmi/articles.html.twig');
46+
return $this->render('::tests/voter/articles.html.twig');
4747
}
4848

4949
public function postAction(Request $request)
5050
{
5151
$content = $request->get(DynamicRouter::CONTENT_KEY);
52-
return $this->render('::tests/cmi/post.html.twig', array('content' => $content));
52+
return $this->render('::tests/voter/post.html.twig', array('content' => $content));
5353
}
5454

5555
public function urlPrefixAction(Request $request)
5656
{
57-
return $this->render('::tests/cmi/requestContent.html.twig', array('content' => $content));
57+
return $this->render('::tests/voter/requestContent.html.twig', array('content' => $content));
5858
}
5959
}

Tests/Resources/DataFixtures/PHPCR/LoadMenuData.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Doctrine\Common\DataFixtures\FixtureInterface;
1616
use Doctrine\Common\Persistence\ObjectManager;
1717
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
18+
use Doctrine\ODM\PHPCR\DocumentManager;
1819
use Symfony\Cmf\Bundle\MenuBundle\Doctrine\Phpcr\MenuNode;
1920
use Symfony\Cmf\Bundle\MenuBundle\Doctrine\Phpcr\Menu;
2021
use Symfony\Cmf\Bundle\MenuBundle\Tests\Resources\Document\Content;
@@ -26,6 +27,8 @@
2627
class LoadMenuData implements FixtureInterface, DependentFixtureInterface
2728
{
2829
protected $root;
30+
protected $menuRoot;
31+
protected $routeRoot;
2932

3033
public function getDependencies()
3134
{
@@ -44,12 +47,12 @@ public function load(ObjectManager $manager)
4447
$this->routeRoot = $manager->find(null, '/test/routes');
4548

4649
$this->loadMainMenu($manager);
47-
$this->loadSideMenu($manager);
50+
$this->loadVoterMenu($manager);
4851

4952
$manager->flush();
5053
}
5154

52-
protected function loadMainMenu($manager)
55+
protected function loadMainMenu(DocumentManager $manager)
5356
{
5457
$content = new Content;
5558
$content->setTitle('Menu Item Content 1');
@@ -129,7 +132,7 @@ protected function loadMainMenu($manager)
129132
$manager->persist($content);
130133
}
131134

132-
protected function loadSideMenu($manager)
135+
protected function loadVoterMenu(DocumentManager $manager)
133136
{
134137
// test content
135138
$content = new Content;
@@ -139,7 +142,7 @@ protected function loadSideMenu($manager)
139142

140143
$route = new Route();
141144
$route->setId('/test/routes/contents/content-1');
142-
$route->setDefault('_controller', 'Symfony\Cmf\Bundle\MenuBundle\Tests\Resources\Controller\CmiTestController::requestContentIdentityAction');
145+
$route->setDefault('_controller', 'Symfony\Cmf\Bundle\MenuBundle\Tests\Resources\Controller\VoterController::requestContentIdentityAction');
143146
$route->setContent($content);
144147
$manager->persist($route);
145148

@@ -151,7 +154,7 @@ protected function loadSideMenu($manager)
151154

152155
$route = new Route();
153156
$route->setId('/test/routes/blog');
154-
$route->setDefault('_controller', 'Symfony\Cmf\Bundle\MenuBundle\Tests\Resources\Controller\CmiTestController::blogAction');
157+
$route->setDefault('_controller', 'Symfony\Cmf\Bundle\MenuBundle\Tests\Resources\Controller\VoterController::blogAction');
155158
$route->setContent($blog);
156159
$manager->persist($route);
157160

@@ -163,7 +166,7 @@ protected function loadSideMenu($manager)
163166

164167
$route = new Route();
165168
$route->setId('/test/routes/blog/my-post');
166-
$route->setDefault('_controller', 'Symfony\Cmf\Bundle\MenuBundle\Tests\Resources\Controller\CmiTestController::postAction');
169+
$route->setDefault('_controller', 'Symfony\Cmf\Bundle\MenuBundle\Tests\Resources\Controller\VoterController::postAction');
167170
$route->setContent($post);
168171
$manager->persist($route);
169172

@@ -175,7 +178,7 @@ protected function loadSideMenu($manager)
175178

176179
$articlesRoute = new Route();
177180
$articlesRoute->setId('/test/routes/articles');
178-
$articlesRoute->setDefault('_controller', 'Symfony\Cmf\Bundle\MenuBundle\Tests\Resources\Controller\CmiTestController::articlesAction');
181+
$articlesRoute->setDefault('_controller', 'Symfony\Cmf\Bundle\MenuBundle\Tests\Resources\Controller\VoterController::articlesAction');
179182
$articlesRoute->setContent($articles);
180183
$articlesRoute->setOption('currentUriPrefix', '/articles');
181184
$manager->persist($articlesRoute);
@@ -191,7 +194,7 @@ protected function loadSideMenu($manager)
191194

192195
$route = new Route();
193196
$route->setId('/test/routes/articles/some-category/article-1');
194-
$route->setDefault('_controller', 'Symfony\Cmf\Bundle\MenuBundle\Tests\Resources\Controller\CmiTestController::postAction');
197+
$route->setDefault('_controller', 'Symfony\Cmf\Bundle\MenuBundle\Tests\Resources\Controller\VoterController::postAction');
195198
$route->setContent($article1);
196199
$manager->persist($route);
197200

Tests/Resources/Document/Content.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
class Content implements MenuNodeReferrersInterface, RouteReferrersReadInterface
2828
{
2929
/**
30-
* @PHPCRODM\Id()
30+
* @PHPCRODM\Id(strategy="assigned")
3131
*/
3232
protected $id;
3333

Tests/Resources/app/Resources/views/tests/cmi/articles.html.twig renamed to Tests/Resources/app/Resources/views/tests/voter/articles.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% extends "::layout.html.twig" %}
22
{% block content %}
3-
{% include "::tests/cmi/_sideMenu.html.twig" %}
3+
{% include "::tests/voter/_sideMenu.html.twig" %}
44
<p>
55
This is the articles page. Click <a href="{{ path('/test/routes/articles/some-category/article-1') }}">To view the article</a>.
66
</p>

Tests/Resources/app/Resources/views/tests/cmi/blog.html.twig renamed to Tests/Resources/app/Resources/views/tests/voter/blog.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% extends "::layout.html.twig" %}
22
{% block content %}
3-
{% include "::tests/cmi/_sideMenu.html.twig" %}
3+
{% include "::tests/voter/_sideMenu.html.twig" %}
44
<p>
55
This is the blog page. Click <a href="{{ path('/test/routes/blog/my-post') }}">To view the blog post.</a>.
66
</p>
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% extends "::layout.html.twig" %}
22
{% block content %}
3-
{% include "::tests/cmi/_sideMenu.html.twig" %}
3+
{% include "::tests/voter/_sideMenu.html.twig" %}
44
<h1>Current Menu Item Test</h1>
55
<p>The request URI of this page matches the URI for the route associated with the "default behavior" menu item on the left.</p>
66
{% endblock %}

Tests/Resources/app/Resources/views/tests/cmi/post.html.twig renamed to Tests/Resources/app/Resources/views/tests/voter/post.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% extends "::layout.html.twig" %}
22
{% block content %}
3-
{% include "::tests/cmi/_sideMenu.html.twig" %}
3+
{% include "::tests/voter/_sideMenu.html.twig" %}
44
<p>
55
This is the blog post page. The "Request Parent Content Identity Voter" menu item should now be highlighted. Click <a href="{{ path('/test/routes/blog') }}">here</a> to return to the blog page.
66
</p>

0 commit comments

Comments
 (0)