forked from ezsystems/PlatformUIBundle
/
RootInfoTest.php
47 lines (41 loc) · 1.4 KB
/
RootInfoTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/**
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
namespace EzSystems\PlatformUIBundle\Tests\ApplicationConfig\Providers;
use EzSystems\PlatformUIBundle\ApplicationConfig\Providers\RootInfo;
use PHPUnit_Framework_TestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
class RootInfoTest extends PHPUnit_Framework_TestCase
{
public function testGetConfig()
{
$provider = new RootInfo($this->createRequestStack(), $this->getAssetsHelperMock());
self::assertEquals(
['root' => '', 'assetRoot' => '/'],
$provider->getConfig()
);
}
/**
* @return \PHPUnit_Framework_MockObject_MockObject
*/
protected function getAssetsHelperMock()
{
$assetsHelper = $this
->getMockBuilder('Symfony\Bundle\FrameworkBundle\Templating\Helper\AssetsHelper')
->disableOriginalConstructor()
->getMock();
$assetsHelper->expects($this->any())->method('getUrl')->willReturn('/');
return $assetsHelper;
}
/**
* @return \Symfony\Component\HttpFoundation\RequestStack
*/
protected function createRequestStack()
{
$requestStack = new RequestStack();
$requestStack->push(new Request([], [], ['semanticPathInfo' => '']));
return $requestStack;
}
}