/**
  * 一般的テスト
  */
 public function testStandardIO()
 {
     // make instance of pathRewriter
     $px = new picklesFramework2\px(__DIR__ . '/testData/standard/px-files/');
     $pathRewriter = new tomk79\pickles2\publishPathRewriter\pathRewriter($px, array("rules" => array(array('/\\/abc\\/([^\\/]+)_files\\/(.*)$/s', '/abc/img/$1_$2'))));
     $this->assertEquals($pathRewriter->convert('/abc/'), '/abc/');
     $this->assertEquals($pathRewriter->convert('/abc/abc_files/1.png'), '/abc/img/abc_1.png');
     $this->assertEquals($pathRewriter->convert('/abc/_files/1.png'), '/abc/_files/1.png');
     $px->site()->__destruct();
     $px = null;
     unset($px);
 }
예제 #2
0
 /**
  * キャッシュの振る舞いのテスト2
  */
 public function testCachesBehavior2()
 {
     $cd = realpath('.');
     chdir(__DIR__ . '/testData/caches_behavior/notmake/');
     $px = new picklesFramework2\px('./px-files/');
     $toppage_info = $px->site()->get_page_info('');
     // var_dump($toppage_info);
     clearstatcache();
     $this->assertTrue(!is_dir('./caches/'));
     $this->assertTrue(is_dir('./px-files/_sys/'));
     $this->assertTrue(is_dir('./px-files/_sys/ram/'));
     $this->assertTrue(is_dir('./px-files/_sys/ram/applock/'));
     $this->assertTrue(is_dir('./px-files/_sys/ram/caches/'));
     $this->assertTrue(is_dir('./px-files/_sys/ram/data/'));
     $this->assertTrue(is_dir('./px-files/_sys/ram/publish/'));
     chdir($cd);
     $px->__destruct();
     // <- required on Windows
     unset($px);
     // 後始末
     $output = $this->px_execute('/caches_behavior/notmake/.px_execute.php', '/?PX=clearcache');
     clearstatcache();
     // var_dump($output);
     $this->assertTrue($this->common_error($output));
     $this->assertTrue(!is_dir(__DIR__ . '/testData/caches_behavior/notmake/caches/p/'));
     $this->assertTrue(!is_dir(__DIR__ . '/testData/caches_behavior/notmake/px-files/_sys/ram/caches/sitemaps/'));
     $this->assertTrue($this->fs->rm(__DIR__ . '/testData/caches_behavior/notmake/px-files/_sys/'));
 }