Backup of db before drupal security update
[yaffs-website] / vendor / symfony-cmf / routing / Tests / Enhancer / ContentRepositoryEnhancerTest.php
1 <?php
2
3 /*
4  * This file is part of the Symfony CMF package.
5  *
6  * (c) 2011-2015 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 namespace Symfony\Cmf\Component\Routing\Tests\Enhancer;
13
14 use Symfony\Cmf\Component\Routing\Enhancer\ContentRepositoryEnhancer;
15 use Symfony\Cmf\Component\Routing\RouteObjectInterface;
16 use Symfony\Cmf\Component\Routing\Test\CmfUnitTestCase;
17 use Symfony\Component\HttpFoundation\Request;
18
19 class ContentRepositoryEnhancerTest extends CmfUnitTestCase
20 {
21     /**
22      * {@inheritdoc}
23      */
24     public function setUp()
25     {
26         $cRepository = $this->getMock('\Symfony\Cmf\Component\Routing\ContentRepositoryInterface');
27         $cRepository
28             ->method('findById')
29             ->will($this->returnValue('document'))
30         ;
31         $this->mapper = new ContentRepositoryEnhancer($cRepository);
32
33         $this->request = Request::create('/test');
34     }
35
36     /**
37      * @dataProvider dataEnhancer
38      */
39     public function testEnhancer($defaults, $expected)
40     {
41         $this->assertEquals($expected, $this->mapper->enhance($defaults, $this->request));
42     }
43
44     /**
45      * @return array
46      */
47     public function dataEnhancer()
48     {
49         return array(
50             'empty' => array(array(), array()),
51             'with content_id' => array(
52                 array(
53                     RouteObjectInterface::CONTENT_ID => 'Simple:1',
54                 ),
55                 array(
56                     RouteObjectInterface::CONTENT_ID => 'Simple:1',
57                     RouteObjectInterface::CONTENT_OBJECT => 'document',
58                 ),
59             ),
60             'with content_id and content' => array(
61                 array(
62                     RouteObjectInterface::CONTENT_ID => 'Simple:1',
63                     RouteObjectInterface::CONTENT_OBJECT => 'exist object',
64                 ),
65                 array(
66                     RouteObjectInterface::CONTENT_ID => 'Simple:1',
67                     RouteObjectInterface::CONTENT_OBJECT => 'exist object',
68                 ),
69             ),
70             'with content' => array(
71                 array(
72                     RouteObjectInterface::CONTENT_OBJECT => 'exist object',
73                 ),
74                 array(
75                     RouteObjectInterface::CONTENT_OBJECT => 'exist object',
76                 ),
77             ),
78         );
79     }
80 }