@@ -33,26 +33,51 @@ protected function setUp()
33
33
public function testBundleNotation ()
34
34
{
35
35
$ input = '@MyBundle/Resources/css/main.css ' ;
36
+ $ bundle = $ this ->getMock ('Symfony \\Component \\HttpKernel \\Bundle \\BundleInterface ' );
36
37
38
+ $ this ->kernel ->expects ($ this ->once ())
39
+ ->method ('getBundle ' )
40
+ ->with ('MyBundle ' )
41
+ ->will ($ this ->returnValue ($ bundle ));
37
42
$ this ->kernel ->expects ($ this ->once ())
38
43
->method ('locateResource ' )
39
44
->with ($ input )
40
- ->will ($ this ->returnValue ('/path/to/bundle/Resources/css/main.css ' ));
45
+ ->will ($ this ->returnValue ('/path/to/MyBundle/Resources/css/main.css ' ));
46
+ $ bundle ->expects ($ this ->once ())
47
+ ->method ('getPath ' )
48
+ ->will ($ this ->returnValue ('/path/to/MyBundle ' ));
49
+
50
+ $ coll = $ this ->factory ->createAsset ($ input )->all ();
51
+ $ asset = $ coll [0 ];
41
52
42
- $ this ->factory ->createAsset ($ input );
53
+ $ this ->assertEquals ('/path/to/MyBundle ' , $ asset ->getSourceRoot (), '->createAsset() sets the asset root ' );
54
+ $ this ->assertEquals ('Resources/css/main.css ' , $ asset ->getSourcePath (), '->createAsset() sets the asset path ' );
43
55
}
44
56
45
57
/**
46
58
* @dataProvider getGlobs
47
59
*/
48
60
public function testBundleGlobNotation ($ input )
49
61
{
62
+ $ bundle = $ this ->getMock ('Symfony \\Component \\HttpKernel \\Bundle \\BundleInterface ' );
63
+
64
+ $ this ->kernel ->expects ($ this ->once ())
65
+ ->method ('getBundle ' )
66
+ ->with ('MyBundle ' )
67
+ ->will ($ this ->returnValue ($ bundle ));
50
68
$ this ->kernel ->expects ($ this ->once ())
51
69
->method ('locateResource ' )
52
70
->with ('@MyBundle/Resources/css/ ' )
53
- ->will ($ this ->returnValue ('/path/to/bundle/Resources/css/ ' ));
71
+ ->will ($ this ->returnValue ('/path/to/MyBundle/Resources/css/ ' ));
72
+ $ bundle ->expects ($ this ->once ())
73
+ ->method ('getPath ' )
74
+ ->will ($ this ->returnValue ('/path/to/MyBundle ' ));
75
+
76
+ $ coll = $ this ->factory ->createAsset ($ input )->all ();
77
+ $ asset = $ coll [0 ];
54
78
55
- $ this ->factory ->createAsset ($ input );
79
+ $ this ->assertEquals ('/path/to/MyBundle ' , $ asset ->getSourceRoot (), '->createAsset() sets the asset root ' );
80
+ $ this ->assertNull ($ asset ->getSourcePath (), '->createAsset() sets the asset path to null ' );
56
81
}
57
82
58
83
public function getGlobs ()
0 commit comments