Esempio n. 1
0
 public function testStyleSheet()
 {
     $groups = new ResourceGroups();
     $groups->addGroup('bootstrap');
     $res = new StyleSheetResourceManager($groups, function (StyleSheetResource $res) {
         $combine = new StyleSheetCombineFiles();
         $combine->setInputDir(__DIR__)->setOutputDir(__DIR__ . '/tmp/cache')->setOutputBaseUrl('/tmp/cache')->setOutputForceRefresh(true)->setOutputLifeTime(0)->setOutputStrategy('manual')->setCacheDb(CombineFilesCacheDB::openFile(__DIR__ . '/tmp/cache/less.db'))->setLessImportDirs(array(__DIR__ . '/tmp/cache/less'))->setLessVariables(array('foo' => 'bar'))->setScssImportDirs(array(__DIR__, __DIR__ . '/tmp/scss'))->setScssVariables(array('foo' => 'bar'));
         $url = new UrlManager();
         $res->setCombineObject($combine);
         $res->setUrlManager($url);
     });
     $this->assertSame($groups, $res->getGroups());
     $res->add(new StyleSheetResource('foo', array('/tmp/less/bootstrap.less', '/tmp/scss/test.scss'), array('combine' => true)), 'bootstrap');
     $this->assertTrue(file_exists(__DIR__ . '/tmp/cache/less.db'));
     foreach ($res->resources() as $css) {
         foreach ($css->getUrl() as $url) {
             $this->assertTrue(file_exists(__DIR__ . $url));
         }
     }
     $this->assertNotEmpty($res->render('html'));
 }