/**
  * Get path of file after using fallback rules
  *
  * @param string $type
  * @param string $file
  * @param string|null $area
  * @param ThemeInterface|null $theme
  * @param string|null $locale
  * @param string|null $module
  * @return string|false
  */
 public function resolve($type, $file, $area = null, ThemeInterface $theme = null, $locale = null, $module = null)
 {
     $path = $this->fallback->resolve($type, $file, $area, $theme, $locale, $module);
     if (!$path && $file != ($newFile = $this->minification->removeMinifiedSign($file))) {
         $path = $this->fallback->resolve($type, $newFile, $area, $theme, $locale, $module);
     }
     return $path;
 }
示例#2
0
    /**
     * Get path of file after using fallback rules
     *
     * @param string $type
     * @param string $file
     * @param string|null $area
     * @param ThemeInterface|null $theme
     * @param string|null $locale
     * @param string|null $module
     * @return string|false
     */
    public function resolve($type, $file, $area = null, ThemeInterface $theme = null, $locale = null, $module = null)
    {
        $fileExtension = pathinfo($file, PATHINFO_EXTENSION);

        if ($fileExtension === 'js') {
            return $this->resolveJsMinification($type, $file, $area, $theme, $locale, $module);
        }

        // Leave BC way of resolving
        $path = $this->fallback->resolve($type, $file, $area, $theme, $locale, $module);

        if (!$path && $file != ($newFile = $this->minification->removeMinifiedSign($file))) {
            $path = $this->fallback->resolve($type, $newFile, $area, $theme, $locale, $module);
        }

        return $path;
    }
 /**
  * @param string $filename
  * @param bool $isEnabled
  * @param string $expected
  * @dataProvider removeMinifiedSignDataProvider
  */
 public function testRemoveMinifiedSign($filename, $isEnabled, $expected)
 {
     $this->scopeConfigMock->expects($this->any())->method('isSetFlag')->willReturn($isEnabled);
     $this->appStateMock->expects($this->any())->method('getMode')->willReturn(State::MODE_DEFAULT);
     $this->assertEquals($expected, $this->minification->removeMinifiedSign($filename));
 }