This repository was archived by the owner on Sep 16, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +45
-0
lines changed
Expand file tree Collapse file tree 3 files changed +45
-0
lines changed Original file line number Diff line number Diff line change 2222use Symfony \Cmf \Bundle \RoutingAutoBundle \Tests \Resources \Document \SeoArticleMultilang ;
2323use Symfony \Cmf \Bundle \RoutingAutoBundle \Tests \Resources \Document \SeoArticle ;
2424use Symfony \Cmf \Component \RoutingAuto \Model \AutoRouteInterface ;
25+ use Symfony \Cmf \Bundle \RoutingAutoBundle \Tests \Resources \Document \Page ;
2526
2627class AutoRouteListenerTest extends BaseTestCase
2728{
@@ -467,6 +468,20 @@ public function testConflictResolverAutoIncrement()
467468 }
468469 }
469470
471+ public function testCreationOfChildOnRoot ()
472+ {
473+ $ page = new Page ;
474+ $ page ->title = 'Home ' ;
475+ $ page ->path = '/test/home ' ;
476+ $ this ->getDm ()->persist ($ page );
477+ $ this ->getDm ()->flush ();
478+
479+ $ expectedRoute = '/test/auto-route/home ' ;
480+ $ route = $ this ->getDm ()->find ('Symfony\Cmf\Bundle\RoutingAutoBundle\Model\AutoRoute ' , $ expectedRoute );
481+
482+ $ this ->assertNotNull ($ route );
483+ }
484+
470485 /**
471486 * @expectedException Symfony\Cmf\Component\RoutingAuto\ConflictResolver\Exception\ExistingUriException
472487 */
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /*
4+ * This file is part of the Symfony CMF package.
5+ *
6+ * (c) 2011-2014 Symfony CMF
7+ *
8+ * For the full copyright and license information, please view the LICENSE
9+ * file that was distributed with this source code.
10+ */
11+
12+
13+ namespace Symfony \Cmf \Bundle \RoutingAutoBundle \Tests \Resources \Document ;
14+
15+ use Doctrine \ODM \PHPCR \Mapping \Annotations as PHPCR ;
16+
17+ /**
18+ * Document mapped to /{title} schema
19+ *
20+ * @PHPCR\Document(referenceable=true)
21+ */
22+ class Page extends SeoArticle
23+ {
24+ }
25+
Original file line number Diff line number Diff line change @@ -35,3 +35,8 @@ Symfony\Cmf\Bundle\RoutingAutoBundle\Tests\Resources\Document\AbstractContent:
3535 uri_schema : /articles/{article_title}
3636 token_providers :
3737 article_title : [content_method, { method: getTitle } ]
38+
39+ Symfony\Cmf\Bundle\RoutingAutoBundle\Tests\Resources\Document\Page :
40+ uri_schema : /{title}
41+ token_providers :
42+ title : [content_method, { method: getTitle } ]
You can’t perform that action at this time.
0 commit comments