1
0

SCSSCacherTest.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2017 Julius Härtl <jus@bitgrid.net>
  4. *
  5. * @author Julius Härtl <jus@bitgrid.net>
  6. *
  7. * @license GNU AGPL version 3 or any later version
  8. *
  9. * This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Affero General Public License as
  11. * published by the Free Software Foundation, either version 3 of the
  12. * License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. *
  22. */
  23. namespace Test\Template;
  24. use OC\Files\AppData\AppData;
  25. use OC\Files\AppData\Factory;
  26. use OC\Template\SCSSCacher;
  27. use OC\Template\IconsCacher;
  28. use OCA\Theming\ThemingDefaults;
  29. use OCP\AppFramework\Utility\ITimeFactory;
  30. use OCP\Files\IAppData;
  31. use OCP\Files\NotFoundException;
  32. use OCP\Files\SimpleFS\ISimpleFile;
  33. use OCP\Files\SimpleFS\ISimpleFolder;
  34. use OCP\ICache;
  35. use OCP\ICacheFactory;
  36. use OCP\IConfig;
  37. use OCP\ILogger;
  38. use OCP\IURLGenerator;
  39. use OC_App;
  40. class SCSSCacherTest extends \Test\TestCase {
  41. /** @var ILogger|\PHPUnit_Framework_MockObject_MockObject */
  42. protected $logger;
  43. /** @var IAppData|\PHPUnit_Framework_MockObject_MockObject */
  44. protected $appData;
  45. /** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */
  46. protected $urlGenerator;
  47. /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
  48. protected $config;
  49. /** @var ThemingDefaults|\PHPUnit_Framework_MockObject_MockObject */
  50. protected $themingDefaults;
  51. /** @var SCSSCacher */
  52. protected $scssCacher;
  53. /** @var ICache|\PHPUnit_Framework_MockObject_MockObject */
  54. protected $depsCache;
  55. /** @var ICacheFactory|\PHPUnit_Framework_MockObject_MockObject */
  56. protected $cacheFactory;
  57. /** @var IconsCacher|\PHPUnit_Framework_MockObject_MockObject */
  58. protected $iconsCacher;
  59. /** @var ITimeFactory|\PHPUnit_Framework_MockObject_MockObject */
  60. protected $timeFactory;
  61. protected function setUp() {
  62. parent::setUp();
  63. $this->logger = $this->createMock(ILogger::class);
  64. $this->appData = $this->createMock(AppData::class);
  65. $this->iconsCacher = $this->createMock(IconsCacher::class);
  66. $this->timeFactory = $this->createMock(ITimeFactory::class);
  67. /** @var Factory|\PHPUnit_Framework_MockObject_MockObject $factory */
  68. $factory = $this->createMock(Factory::class);
  69. $factory->method('get')->with('css')->willReturn($this->appData);
  70. $this->urlGenerator = $this->createMock(IURLGenerator::class);
  71. $this->urlGenerator->expects($this->any())
  72. ->method('getBaseUrl')
  73. ->willReturn('http://localhost/nextcloud');
  74. $this->config = $this->createMock(IConfig::class);
  75. $this->cacheFactory = $this->createMock(ICacheFactory::class);
  76. $this->depsCache = $this->createMock(ICache::class);
  77. $this->cacheFactory->expects($this->at(0))
  78. ->method('createDistributed')
  79. ->willReturn($this->depsCache);
  80. $this->themingDefaults = $this->createMock(ThemingDefaults::class);
  81. $this->themingDefaults->expects($this->any())->method('getScssVariables')->willReturn([]);
  82. $iconsFile = $this->createMock(ISimpleFile::class);
  83. $this->iconsCacher->expects($this->any())
  84. ->method('getCachedCSS')
  85. ->willReturn($iconsFile);
  86. $this->scssCacher = new SCSSCacher(
  87. $this->logger,
  88. $factory,
  89. $this->urlGenerator,
  90. $this->config,
  91. $this->themingDefaults,
  92. \OC::$SERVERROOT,
  93. $this->cacheFactory,
  94. $this->iconsCacher,
  95. $this->timeFactory
  96. );
  97. }
  98. public function testProcessUncachedFileNoAppDataFolder() {
  99. $folder = $this->createMock(ISimpleFolder::class);
  100. $file = $this->createMock(ISimpleFile::class);
  101. $file->expects($this->any())->method('getSize')->willReturn(1);
  102. $this->appData->expects($this->once())->method('getFolder')->with('core')->willThrowException(new NotFoundException());
  103. $this->appData->expects($this->once())->method('newFolder')->with('core')->willReturn($folder);
  104. $this->appData->method('getDirectoryListing')->willReturn([]);
  105. $fileDeps = $this->createMock(ISimpleFile::class);
  106. $gzfile = $this->createMock(ISimpleFile::class);
  107. $filePrefix = substr(md5(\OC_Util::getVersionString('core')), 0, 4) . '-' .
  108. substr(md5('http://localhost/nextcloud/index.php'), 0, 4) . '-';
  109. $folder->method('getFile')
  110. ->will($this->returnCallback(function($path) use ($file, $gzfile, $filePrefix) {
  111. if ($path === $filePrefix.'styles.css') {
  112. return $file;
  113. } else if ($path === $filePrefix.'styles.css.deps') {
  114. throw new NotFoundException();
  115. } else if ($path === $filePrefix.'styles.css.gzip') {
  116. return $gzfile;
  117. } else {
  118. $this->fail();
  119. }
  120. }));
  121. $folder->expects($this->once())
  122. ->method('newFile')
  123. ->with($filePrefix.'styles.css.deps')
  124. ->willReturn($fileDeps);
  125. $this->urlGenerator->expects($this->once())
  126. ->method('getBaseUrl')
  127. ->willReturn('http://localhost/nextcloud');
  128. $this->iconsCacher->expects($this->any())
  129. ->method('setIconsCss')
  130. ->willReturn('scss {}');
  131. $actual = $this->scssCacher->process(\OC::$SERVERROOT, '/core/css/styles.scss', 'core');
  132. $this->assertTrue($actual);
  133. }
  134. public function testProcessUncachedFile() {
  135. $folder = $this->createMock(ISimpleFolder::class);
  136. $this->appData->expects($this->once())->method('getFolder')->with('core')->willReturn($folder);
  137. $this->appData->method('getDirectoryListing')->willReturn([]);
  138. $file = $this->createMock(ISimpleFile::class);
  139. $file->expects($this->any())->method('getSize')->willReturn(1);
  140. $fileDeps = $this->createMock(ISimpleFile::class);
  141. $gzfile = $this->createMock(ISimpleFile::class);
  142. $filePrefix = substr(md5(\OC_Util::getVersionString('core')), 0, 4) . '-' .
  143. substr(md5('http://localhost/nextcloud/index.php'), 0, 4) . '-';
  144. $folder->method('getFile')
  145. ->will($this->returnCallback(function($path) use ($file, $gzfile, $filePrefix) {
  146. if ($path === $filePrefix.'styles.css') {
  147. return $file;
  148. } else if ($path === $filePrefix.'styles.css.deps') {
  149. throw new NotFoundException();
  150. } else if ($path === $filePrefix.'styles.css.gzip') {
  151. return $gzfile;
  152. }else {
  153. $this->fail();
  154. }
  155. }));
  156. $folder->expects($this->once())
  157. ->method('newFile')
  158. ->with($filePrefix.'styles.css.deps')
  159. ->willReturn($fileDeps);
  160. $this->iconsCacher->expects($this->any())
  161. ->method('setIconsCss')
  162. ->willReturn('scss {}');
  163. $actual = $this->scssCacher->process(\OC::$SERVERROOT, '/core/css/styles.scss', 'core');
  164. $this->assertTrue($actual);
  165. }
  166. public function testProcessCachedFile() {
  167. $folder = $this->createMock(ISimpleFolder::class);
  168. $this->appData->expects($this->once())->method('getFolder')->with('core')->willReturn($folder);
  169. $this->appData->method('getDirectoryListing')->willReturn([]);
  170. $file = $this->createMock(ISimpleFile::class);
  171. $fileDeps = $this->createMock(ISimpleFile::class);
  172. $fileDeps->expects($this->any())->method('getSize')->willReturn(1);
  173. $gzFile = $this->createMock(ISimpleFile::class);
  174. $filePrefix = substr(md5(\OC_Util::getVersionString('core')), 0, 4) . '-' .
  175. substr(md5('http://localhost/nextcloud/index.php'), 0, 4) . '-';
  176. $folder->method('getFile')
  177. ->will($this->returnCallback(function($name) use ($file, $fileDeps, $gzFile, $filePrefix) {
  178. if ($name === $filePrefix.'styles.css') {
  179. return $file;
  180. } else if ($name === $filePrefix.'styles.css.deps') {
  181. return $fileDeps;
  182. } else if ($name === $filePrefix.'styles.css.gzip') {
  183. return $gzFile;
  184. }
  185. $this->fail();
  186. }));
  187. $this->iconsCacher->expects($this->any())
  188. ->method('setIconsCss')
  189. ->willReturn('scss {}');
  190. $actual = $this->scssCacher->process(\OC::$SERVERROOT, '/core/css/styles.scss', 'core');
  191. $this->assertTrue($actual);
  192. }
  193. public function testProcessCachedFileMemcache() {
  194. $folder = $this->createMock(ISimpleFolder::class);
  195. $this->appData->expects($this->once())
  196. ->method('getFolder')
  197. ->with('core')
  198. ->willReturn($folder);
  199. $folder->method('getName')
  200. ->willReturn('core');
  201. $this->appData->method('getDirectoryListing')->willReturn([]);
  202. $file = $this->createMock(ISimpleFile::class);
  203. $fileDeps = $this->createMock(ISimpleFile::class);
  204. $fileDeps->expects($this->any())->method('getSize')->willReturn(1);
  205. $gzFile = $this->createMock(ISimpleFile::class);
  206. $filePrefix = substr(md5(\OC_Util::getVersionString('core')), 0, 4) . '-' .
  207. substr(md5('http://localhost/nextcloud/index.php'), 0, 4) . '-';
  208. $folder->method('getFile')
  209. ->will($this->returnCallback(function($name) use ($file, $fileDeps, $gzFile, $filePrefix) {
  210. if ($name === $filePrefix.'styles.css') {
  211. return $file;
  212. } else if ($name === $filePrefix.'styles.css.deps') {
  213. return $fileDeps;
  214. } else if ($name === $filePrefix.'styles.css.gzip') {
  215. return $gzFile;
  216. }
  217. $this->fail();
  218. }));
  219. $this->iconsCacher->expects($this->any())
  220. ->method('setIconsCss')
  221. ->willReturn('scss {}');
  222. $actual = $this->scssCacher->process(\OC::$SERVERROOT, '/core/css/styles.scss', 'core');
  223. $this->assertTrue($actual);
  224. }
  225. public function testIsCachedNoFile() {
  226. $fileNameCSS = "styles.css";
  227. $folder = $this->createMock(ISimpleFolder::class);
  228. $folder->expects($this->at(0))->method('getFile')->with($fileNameCSS)->willThrowException(new NotFoundException());
  229. $this->appData->expects($this->any())
  230. ->method('getFolder')
  231. ->willReturn($folder);
  232. $actual = self::invokePrivate($this->scssCacher, 'isCached', [$fileNameCSS, 'core']);
  233. $this->assertFalse($actual);
  234. }
  235. public function testIsCachedNoDepsFile() {
  236. $fileNameCSS = "styles.css";
  237. $folder = $this->createMock(ISimpleFolder::class);
  238. $file = $this->createMock(ISimpleFile::class);
  239. $file->expects($this->once())->method('getSize')->willReturn(1);
  240. $folder->method('getFile')
  241. ->will($this->returnCallback(function($path) use ($file) {
  242. if ($path === 'styles.css') {
  243. return $file;
  244. } else if ($path === 'styles.css.deps') {
  245. throw new NotFoundException();
  246. } else {
  247. $this->fail();
  248. }
  249. }));
  250. $this->appData->expects($this->any())
  251. ->method('getFolder')
  252. ->willReturn($folder);
  253. $actual = self::invokePrivate($this->scssCacher, 'isCached', [$fileNameCSS, 'core']);
  254. $this->assertFalse($actual);
  255. }
  256. public function testCacheNoFile() {
  257. $fileNameCSS = "styles.css";
  258. $fileNameSCSS = "styles.scss";
  259. $folder = $this->createMock(ISimpleFolder::class);
  260. $file = $this->createMock(ISimpleFile::class);
  261. $depsFile = $this->createMock(ISimpleFile::class);
  262. $gzipFile = $this->createMock(ISimpleFile::class);
  263. $webDir = "core/css";
  264. $path = \OC::$SERVERROOT . '/core/css/';
  265. $folder->method('getFile')->willThrowException(new NotFoundException());
  266. $folder->method('newFile')->will($this->returnCallback(function($fileName) use ($file, $depsFile, $gzipFile) {
  267. if ($fileName === 'styles.css') {
  268. return $file;
  269. } else if ($fileName === 'styles.css.deps') {
  270. return $depsFile;
  271. } else if ($fileName === 'styles.css.gzip') {
  272. return $gzipFile;
  273. }
  274. throw new \Exception();
  275. }));
  276. $this->iconsCacher->expects($this->any())
  277. ->method('setIconsCss')
  278. ->willReturn('scss {}');
  279. $file->expects($this->once())->method('putContent');
  280. $depsFile->expects($this->once())->method('putContent');
  281. $gzipFile->expects($this->once())->method('putContent');
  282. $actual = self::invokePrivate($this->scssCacher, 'cache', [$path, $fileNameCSS, $fileNameSCSS, $folder, $webDir]);
  283. $this->assertTrue($actual);
  284. }
  285. public function testCache() {
  286. $fileNameCSS = "styles.css";
  287. $fileNameSCSS = "styles.scss";
  288. $folder = $this->createMock(ISimpleFolder::class);
  289. $file = $this->createMock(ISimpleFile::class);
  290. $depsFile = $this->createMock(ISimpleFile::class);
  291. $gzipFile = $this->createMock(ISimpleFile::class);
  292. $webDir = "core/css";
  293. $path = \OC::$SERVERROOT;
  294. $folder->method('getFile')->will($this->returnCallback(function($fileName) use ($file, $depsFile, $gzipFile) {
  295. if ($fileName === 'styles.css') {
  296. return $file;
  297. } else if ($fileName === 'styles.css.deps') {
  298. return $depsFile;
  299. } else if ($fileName === 'styles.css.gzip') {
  300. return $gzipFile;
  301. }
  302. throw new \Exception();
  303. }));
  304. $file->expects($this->once())->method('putContent');
  305. $depsFile->expects($this->once())->method('putContent');
  306. $gzipFile->expects($this->once())->method('putContent');
  307. $this->iconsCacher->expects($this->any())
  308. ->method('setIconsCss')
  309. ->willReturn('scss {}');
  310. $actual = self::invokePrivate($this->scssCacher, 'cache', [$path, $fileNameCSS, $fileNameSCSS, $folder, $webDir]);
  311. $this->assertTrue($actual);
  312. }
  313. public function testCacheSuccess() {
  314. $fileNameCSS = "styles-success.css";
  315. $fileNameSCSS = "../../tests/data/scss/styles-success.scss";
  316. $folder = $this->createMock(ISimpleFolder::class);
  317. $file = $this->createMock(ISimpleFile::class);
  318. $depsFile = $this->createMock(ISimpleFile::class);
  319. $gzipFile = $this->createMock(ISimpleFile::class);
  320. $webDir = "tests/data/scss";
  321. $path = \OC::$SERVERROOT . $webDir;
  322. $folder->method('getFile')->will($this->returnCallback(function($fileName) use ($file, $depsFile, $gzipFile) {
  323. if ($fileName === 'styles-success.css') {
  324. return $file;
  325. } else if ($fileName === 'styles-success.css.deps') {
  326. return $depsFile;
  327. } else if ($fileName === 'styles-success.css.gzip') {
  328. return $gzipFile;
  329. }
  330. throw new \Exception();
  331. }));
  332. $this->iconsCacher->expects($this->at(0))
  333. ->method('setIconsCss')
  334. ->willReturn('body{background-color:#0082c9}');
  335. $file->expects($this->at(0))->method('putContent')->with($this->callback(
  336. function ($content){
  337. return 'body{background-color:#0082c9}' === $content;
  338. }));
  339. $depsFile->expects($this->at(0))->method('putContent')->with($this->callback(
  340. function ($content) {
  341. $deps = json_decode($content, true);
  342. return array_key_exists(\OC::$SERVERROOT . '/core/css/variables.scss', $deps)
  343. && array_key_exists(\OC::$SERVERROOT . '/tests/data/scss/styles-success.scss', $deps);
  344. }));
  345. $gzipFile->expects($this->at(0))->method('putContent')->with($this->callback(
  346. function ($content) {
  347. return gzdecode($content) === 'body{background-color:#0082c9}';
  348. }
  349. ));
  350. $actual = self::invokePrivate($this->scssCacher, 'cache', [$path, $fileNameCSS, $fileNameSCSS, $folder, $webDir]);
  351. $this->assertTrue($actual);
  352. }
  353. public function testCacheFailure() {
  354. $fileNameCSS = "styles-error.css";
  355. $fileNameSCSS = "../../tests/data/scss/styles-error.scss";
  356. $folder = $this->createMock(ISimpleFolder::class);
  357. $file = $this->createMock(ISimpleFile::class);
  358. $depsFile = $this->createMock(ISimpleFile::class);
  359. $webDir = "/tests/data/scss";
  360. $path = \OC::$SERVERROOT . $webDir;
  361. $folder->expects($this->at(0))->method('getFile')->with($fileNameCSS)->willReturn($file);
  362. $folder->expects($this->at(1))->method('getFile')->with($fileNameCSS . '.deps')->willReturn($depsFile);
  363. $actual = self::invokePrivate($this->scssCacher, 'cache', [$path, $fileNameCSS, $fileNameSCSS, $folder, $webDir]);
  364. $this->assertFalse($actual);
  365. }
  366. public function dataRebaseUrls() {
  367. return [
  368. ['#id { background-image: url(\'../img/image.jpg\'); }','#id { background-image: url(\'/apps/files/css/../img/image.jpg\'); }'],
  369. ['#id { background-image: url("../img/image.jpg"); }','#id { background-image: url(\'/apps/files/css/../img/image.jpg\'); }'],
  370. ['#id { background-image: url(\'/img/image.jpg\'); }','#id { background-image: url(\'/img/image.jpg\'); }'],
  371. ['#id { background-image: url("http://example.com/test.jpg"); }','#id { background-image: url("http://example.com/test.jpg"); }'],
  372. ];
  373. }
  374. /**
  375. * @dataProvider dataRebaseUrls
  376. */
  377. public function testRebaseUrls($scss, $expected) {
  378. $webDir = '/apps/files/css';
  379. $actual = self::invokePrivate($this->scssCacher, 'rebaseUrls', [$scss, $webDir]);
  380. $this->assertEquals($expected, $actual);
  381. }
  382. public function dataGetCachedSCSS() {
  383. return [
  384. ['core', 'core/css/styles.scss', '/css/core/styles.css', \OC_Util::getVersionString()],
  385. ['files', 'apps/files/css/styles.scss', '/css/files/styles.css', \OC_App::getAppVersion('files')]
  386. ];
  387. }
  388. /**
  389. * @param $appName
  390. * @param $fileName
  391. * @param $result
  392. * @dataProvider dataGetCachedSCSS
  393. */
  394. public function testGetCachedSCSS($appName, $fileName, $result, $version) {
  395. $this->urlGenerator->expects($this->once())
  396. ->method('linkToRoute')
  397. ->with('core.Css.getCss', [
  398. 'fileName' => substr(md5($version), 0, 4) . '-' .
  399. substr(md5('http://localhost/nextcloud/index.php'), 0, 4) . '-styles.css',
  400. 'appName' => $appName,
  401. 'v' => 0,
  402. ])
  403. ->willReturn(\OC::$WEBROOT . $result);
  404. $actual = $this->scssCacher->getCachedSCSS($appName, $fileName);
  405. $this->assertEquals(substr($result, 1), $actual);
  406. }
  407. private function randomString() {
  408. return sha1(uniqid(mt_rand(), true));
  409. }
  410. private function rrmdir($directory) {
  411. $files = array_diff(scandir($directory), array('.','..'));
  412. foreach ($files as $file) {
  413. if (is_dir($directory . '/' . $file)) {
  414. $this->rrmdir($directory . '/' . $file);
  415. } else {
  416. unlink($directory . '/' . $file);
  417. }
  418. }
  419. return rmdir($directory);
  420. }
  421. public function dataGetWebDir() {
  422. return [
  423. // Root installation
  424. ['/http/core/css', 'core', '', '/http', '/core/css'],
  425. ['/http/apps/scss/css', 'scss', '', '/http', '/apps/scss/css'],
  426. ['/srv/apps2/scss/css', 'scss', '', '/http', '/apps2/scss/css'],
  427. // Sub directory install
  428. ['/http/nextcloud/core/css', 'core', '/nextcloud', '/http/nextcloud', '/nextcloud/core/css'],
  429. ['/http/nextcloud/apps/scss/css', 'scss', '/nextcloud', '/http/nextcloud', '/nextcloud/apps/scss/css'],
  430. ['/srv/apps2/scss/css', 'scss', '/nextcloud', '/http/nextcloud', '/apps2/scss/css']
  431. ];
  432. }
  433. /**
  434. * @param $path
  435. * @param $appName
  436. * @param $webRoot
  437. * @param $serverRoot
  438. * @dataProvider dataGetWebDir
  439. */
  440. public function testgetWebDir($path, $appName, $webRoot, $serverRoot, $correctWebDir) {
  441. $tmpDir = sys_get_temp_dir().'/'.$this->randomString();
  442. // Adding fake apps folder and create fake app install
  443. \OC::$APPSROOTS[] = [
  444. 'path' => $tmpDir.'/srv/apps2',
  445. 'url' => '/apps2',
  446. 'writable' => false
  447. ];
  448. mkdir($tmpDir.$path, 0777, true);
  449. $actual = self::invokePrivate($this->scssCacher, 'getWebDir', [$tmpDir.$path, $appName, $tmpDir.$serverRoot, $webRoot]);
  450. $this->assertEquals($correctWebDir, $actual);
  451. array_pop(\OC::$APPSROOTS);
  452. $this->rrmdir($tmpDir.$path);
  453. }
  454. public function testResetCache() {
  455. $file = $this->createMock(ISimpleFile::class);
  456. $file->expects($this->once())
  457. ->method('delete');
  458. $folder = $this->createMock(ISimpleFolder::class);
  459. $folder->expects($this->once())
  460. ->method('getDirectoryListing')
  461. ->willReturn([$file]);
  462. $cache = $this->createMock(ICache::class);
  463. $this->cacheFactory->expects($this->once())
  464. ->method('createDistributed')
  465. ->willReturn($cache);
  466. $cache->expects($this->once())
  467. ->method('clear')
  468. ->with('');
  469. $this->appData->expects($this->once())
  470. ->method('getDirectoryListing')
  471. ->willReturn([$folder]);
  472. $this->scssCacher->resetCache();
  473. }
  474. }