public function testProcess_main_dir_explot() { $PWE = new UnitTestPWECore(); mkdir($PWE->getTempDirectory() . '/subdir'); file_put_contents($PWE->getTempDirectory() . '/subdir/test.wiki', ""); $PWE->setStructFile(__DIR__ . '/SimpleWiki.xml'); $PWE->setURL('/subdir:..:test/'); $obj = new SimpleWiki($PWE); try { $obj->process(); $this->fail(); } catch (HTTP4xxException $e) { } }
public function test_directory_sorted() { $pwe = new UnitTestPWECore(); $pwe->setURL('/'); $tmp = $pwe->getTempDirectory(); $pwe->setRootDirectory($tmp); $pwe->setTempDirectory($tmp); PWELogger::info("Create dir " . $tmp); file_put_contents($tmp . '/first', time()); file_put_contents($tmp . '/second', time()); PWELogger::debug("File 1 " . file_get_contents($tmp . '/first')); PWELogger::debug("File 2 " . file_get_contents($tmp . '/second')); $node =& $pwe->getNode(); $node['!a']['files_base'] = '.'; $obj = new FileDownloads($pwe); $res = $obj->getDirectoryBlock('.'); PWELogger::debug("DIR: " . $res); $this->assertGreaterThan(strpos($res, 'second'), strpos($res, 'first')); }
public function testProcess() { $pwe = new UnitTestPWECore(); copy(__DIR__ . '/preprocess.tpl', $pwe->getTempDirectory() . '/test.tpl'); $obj = new CSSJSPreprocessor($pwe); $obj->preprocess($pwe->getTempDirectory(), $pwe->getTempDirectory()); $test_tpl = file_get_contents($pwe->getTempDirectory() . '/test.tpl'); $pwe_js = file_get_contents($pwe->getTempDirectory() . '/pwe.js'); $pwe_css = file_get_contents($pwe->getTempDirectory() . '/pwe.css'); PWELogger::debug("TPL: {$test_tpl}"); PWELogger::debug("JS: {$pwe_js}"); PWELogger::debug("CSS: {$pwe_css}"); $this->assertContains("do_process_css", $pwe_css); $this->assertNotContains("not_process_css", $pwe_css); $this->assertContains("not_process_css", $test_tpl); $this->assertNotContains("do_process_css", $test_tpl); $this->assertContains("do_process_js", $pwe_js); $this->assertNotContains("not_process_js", $pwe_js); $this->assertContains("not_process_js", $test_tpl); $this->assertNotContains("do_process_js", $test_tpl); }
public function testSetup() { $this->PWE->setDataDirectory($this->PWE->getTempDirectory()); $registerData = array(); HTMLPage::setup($this->PWE, $registerData); }