public function testCacheInvalidate() { TestView::SetupPaths(); file_put_contents(View::cache_path() . '/cache_test.phpi', 'Invalid template data'); $view = new TestView('cache_test'); // Need to wait for the mtime to make a difference. sleep(1); clearstatcache(); // Touch the template to update its mtime. touch(sprintf(View::template_path(), 'cache_test')); $files = scandir(View::cache_path()); $this->assertEquals(3, count($files)); $view->T_Cache(); $files = scandir(View::cache_path()); $this->assertEquals(3, count($files)); $expected = file_get_contents(sprintf(View::template_path(), 'cache_test')); $actual = file_get_contents(View::cache_path() . '/cache_test.phpi'); $this->assertEquals($expected, $actual); }