1 | <?php |
||
24 | final class PathPackageSpec extends ObjectBehavior |
||
25 | { |
||
26 | function let( |
||
33 | |||
34 | function it_implements_package_interface_interface() |
||
35 | { |
||
36 | $this->shouldImplement(PackageInterface::class); |
||
37 | } |
||
38 | |||
39 | function it_returns_vanilla_path_if_there_are_no_active_themes( |
||
40 | ThemeContextInterface $themeContext, |
||
41 | VersionStrategyInterface $versionStrategy |
||
42 | ) { |
||
43 | $path = 'bundles/sample/asset.js'; |
||
44 | $versionedPath = 'bundles/sample/asset.js?v=42'; |
||
45 | |||
46 | $themeContext->getTheme()->shouldBeCalled()->willReturn(null); |
||
47 | $versionStrategy->applyVersion($path)->shouldBeCalled()->willReturn($versionedPath); |
||
48 | |||
49 | $this->getUrl($path)->shouldReturn('/' . $versionedPath); |
||
50 | } |
||
51 | |||
52 | function it_returns_modified_path_if_there_is_active_theme( |
||
53 | ThemeContextInterface $themeContext, |
||
54 | VersionStrategyInterface $versionStrategy, |
||
55 | PathResolverInterface $pathResolver, |
||
56 | ThemeInterface $theme |
||
57 | ) { |
||
58 | $path = 'bundles/sample/asset.js'; |
||
59 | $themedPath = 'bundles/theme/foo/bar/sample/asset.js'; |
||
60 | $versionedThemedPath = 'bundles/theme/foo/bar/sample/asset.js?v=42'; |
||
61 | |||
62 | $themeContext->getTheme()->shouldBeCalled()->willReturn($theme); |
||
63 | $pathResolver->resolve($path, $theme)->shouldBeCalled()->willReturn($themedPath); |
||
64 | $versionStrategy->applyVersion($themedPath)->shouldBeCalled()->willReturn($versionedThemedPath); |
||
65 | |||
66 | $this->getUrl($path)->shouldReturn('/' . $versionedThemedPath); |
||
67 | } |
||
68 | |||
69 | function it_returns_path_without_changes_if_it_is_absolute() |
||
74 | |||
75 | function it_does_not_prepend_it_with_base_path_if_modified_path_is_an_absolute_one( |
||
91 | |||
92 | function it_does_not_prepend_it_with_base_path_if_modified_path_is_an_absolute_url( |
||
108 | } |
||
109 |