4 * This file is part of the Symfony CMF package.
6 * (c) 2011-2015 Symfony CMF
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Cmf\Component\Routing\Tests\Enhancer;
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;
19 class ContentRepositoryEnhancerTest extends CmfUnitTestCase
24 public function setUp()
26 $cRepository = $this->getMock('\Symfony\Cmf\Component\Routing\ContentRepositoryInterface');
29 ->will($this->returnValue('document'))
31 $this->mapper = new ContentRepositoryEnhancer($cRepository);
33 $this->request = Request::create('/test');
37 * @dataProvider dataEnhancer
39 public function testEnhancer($defaults, $expected)
41 $this->assertEquals($expected, $this->mapper->enhance($defaults, $this->request));
47 public function dataEnhancer()
50 'empty' => array(array(), array()),
51 'with content_id' => array(
53 RouteObjectInterface::CONTENT_ID => 'Simple:1',
56 RouteObjectInterface::CONTENT_ID => 'Simple:1',
57 RouteObjectInterface::CONTENT_OBJECT => 'document',
60 'with content_id and content' => array(
62 RouteObjectInterface::CONTENT_ID => 'Simple:1',
63 RouteObjectInterface::CONTENT_OBJECT => 'exist object',
66 RouteObjectInterface::CONTENT_ID => 'Simple:1',
67 RouteObjectInterface::CONTENT_OBJECT => 'exist object',
70 'with content' => array(
72 RouteObjectInterface::CONTENT_OBJECT => 'exist object',
75 RouteObjectInterface::CONTENT_OBJECT => 'exist object',