assertTrue($cache->store($id, $data), "$id store"); $this->assertEquals($cache->getSize($id), $this->countBytes($data), "$id getSize"); $this->assertTrue($cache->isValid($id, $_SERVER['REQUEST_TIME'] - 10), "$id isValid"); ob_start(); $cache->display($id); $displayed = ob_get_contents(); ob_end_clean(); $this->assertSame($data, $displayed, "$id display"); $this->assertEquals($data, $cache->fetch($id), "$id fetch"); } /** * Read data file, assert that it exists and is not empty. * As a side effect calls trim() to fight against different Editors that insert or strip final newline. * * @param string $filename * @return string */ protected function getDataFile($filename) { $path = self::$test_files . '/' . $filename; $this->assertFileExists($path); $contents = file_get_contents($path); $this->assertNotEmpty($contents); $contents = trim($contents); $this->assertNotEmpty($contents); return $contents; } }