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 22
22
use Symfony \Cmf \Bundle \RoutingAutoBundle \Tests \Resources \Document \SeoArticleMultilang ;
23
23
use Symfony \Cmf \Bundle \RoutingAutoBundle \Tests \Resources \Document \SeoArticle ;
24
24
use Symfony \Cmf \Component \RoutingAuto \Model \AutoRouteInterface ;
25
+ use Symfony \Cmf \Bundle \RoutingAutoBundle \Tests \Resources \Document \Page ;
25
26
26
27
class AutoRouteListenerTest extends BaseTestCase
27
28
{
@@ -467,6 +468,20 @@ public function testConflictResolverAutoIncrement()
467
468
}
468
469
}
469
470
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
+
470
485
/**
471
486
* @expectedException Symfony\Cmf\Component\RoutingAuto\ConflictResolver\Exception\ExistingUriException
472
487
*/
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:
35
35
uri_schema : /articles/{article_title}
36
36
token_providers :
37
37
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