function testNotFoundFile() { $root = lmb_env_get('LIMB_VAR_DIR') . '/www'; lmb_env_set('LIMB_DOCUMENT_ROOT', $root); lmbFs::rm($root); $template = '{{js_combined dir="media/"}}{{js_once src="js/main.js" }}{{/js_combined}}'; $page = $this->_createMacroTemplate($template, 'tpl.html'); try { $page->render(); $this->assertTrue(false); } catch (lmbException $e) { $this->assertTrue(true); } lmbFs::safeWrite($root . '/js/blog.js', 'function blog() {};'); $template = '{{js_combined dir="media"}}{{js_once src="js/main.js" safe="true" }}{{js_once src="js/blog.js" }}{{/js_combined}}'; $page = $this->_createMacroTemplate($template, 'tpl.html'); $page->render(); $file = array_shift(lmbFs::ls($root . '/media/')); $js_content = "/* include main.js - NOT FOUND */\n\n/* include blog.js */\nfunction blog() {};"; $this->assertEqual(file_get_contents($root . '/media/' . $file), $js_content); }
function testCpDirsWithInclude() { $this->_createFileSystem(); $res = lmbFs::cp(LIMB_VAR_DIR . '/tmp/wow', LIMB_VAR_DIR . '/tmp/cp', null, '/test2/'); $this->assertEqual($this->_sort($res), $this->_sort(array('test2_1', 'test2_2', 'test2_3'))); $this->assertEqual($this->_sort($res), $this->_sort(lmbFs::ls(LIMB_VAR_DIR . '/tmp/cp/'))); $this->assertFalse(is_dir(LIMB_VAR_DIR . '/tmp/cp/hey')); $this->_removeFileSystem(); }