public function testIsCached() { $pc = new PageCache(__DIR__ . '/config_test.php'); $pc->setPath(vfsStream::url('tmpdir') . '/'); //no cache exists $this->assertFalse($pc->isCached(), ' is cached'); $this->assertFalse(file_exists($pc->getFilePath()), 'file exists'); //cache page $pc->init(); $output = 'testIsCached() being test... this line is going to populate cache file for testing...'; echo $output; //manually end output buffering. file cache must exist ob_end_flush(); //cache exists now $this->assertTrue($pc->isCached()); $this->assertTrue(file_exists($pc->getFilePath()), __METHOD__ . ' after init cache file does not exist'); $this->assertEquals($output, file_get_contents($pc->getFilePath()), 'Cache file contents not as expected.'); }