Skip to content

Commit a461992

Browse files
garakfabpot
authored andcommitted
Dynamic bundle assets
1 parent 8927528 commit a461992

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

Bundle/Bundle.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@ public function registerCommands(Application $application)
135135
{
136136
}
137137

138+
public function getPublicPath(): string
139+
{
140+
return 'Resources/public';
141+
}
142+
138143
/**
139144
* Returns the bundle's container extension class.
140145
*

Bundle/BundleInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
* BundleInterface.
2020
*
2121
* @author Fabien Potencier <[email protected]>
22+
*
23+
* @method string getPublicPath() Returns relative path for public assets
2224
*/
2325
interface BundleInterface extends ContainerAwareInterface
2426
{

Tests/KernelTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ protected function getBundle($dir = null, $parent = null, $className = null, $bu
627627
{
628628
$bundle = $this
629629
->getMockBuilder('Symfony\Component\HttpKernel\Bundle\BundleInterface')
630-
->setMethods(['getPath', 'getParent', 'getName'])
630+
->setMethods(['getPath', 'getPublicPath', 'getParent', 'getName'])
631631
->disableOriginalConstructor()
632632
;
633633

@@ -649,6 +649,12 @@ protected function getBundle($dir = null, $parent = null, $className = null, $bu
649649
->willReturn($dir)
650650
;
651651

652+
$bundle
653+
->expects($this->any())
654+
->method('getPublicPath')
655+
->willReturn('Resources/public')
656+
;
657+
652658
$bundle
653659
->expects($this->any())
654660
->method('getParent')

0 commit comments

Comments
 (0)