tmpDir = sys_get_temp_dir() . '/resource-watchers-tests'; $this->cacheFile = $this->tmpDir . '/cache-file-test.php'; $this->fs = new Filesystem(); $this->fs->mkdir($this->tmpDir); } public function tearDown() { $this->fs->remove($this->tmpDir); } public function testIsInitializedMustReturnFalseWhenTheCacheFileIsNotExists() { $resourceCache = new ResourceCachePhpFile($this->cacheFile); $this->assertFalse($resourceCache->isInitialized()); } public function testIsInitializedMustReturnTrueWhenTheCacheIsSavedInTheCacheFile() { $resourceCache = new ResourceCachePhpFile($this->cacheFile); $resourceCache->save(); $this->assertTrue($resourceCache->isInitialized()); } public function testIsInitializedMustReturnTrueWhenThereIsAValidCacheFile() { $this->fs->dumpFile($this->cacheFile, "cacheFile); $this->assertTrue($resourceCache->isInitialized()); } public function testSaveMustDumpTheContentCacheInAFile() { $resourceCache = new ResourceCachePhpFile($this->cacheFile); $filename = 'file1.md'; $hash = '23998C'; $resourceCache->write($filename, $hash); $resourceCache->save(); $fileContent = file_get_contents($this->cacheFile); $this->assertEquals($fileContent, "'$hash',];"); } /** * @expectedException InvalidArgumentException * @expectedExceptionMessage Cache file invalid format. */ public function testConstructWithAInvalidCacheFileMustThrownAnException() { $this->fs->dumpFile($this->cacheFile, ''); $rc = new ResourceCachePhpFile($this->cacheFile); } /** * @expectedException InvalidArgumentException * @expectedExceptionMessage The cache filename must ends with the extension ".php". */ public function testConstructWithANoPhpFileExtensionMustThrownAnException() { $rc = new ResourceCachePhpFile($this->tmpDir . '/cache-file-test.txt'); } } __halt_compiler();----SIGNATURE:----QhutpvtL5BT0kJ7/gIep3Z1SU1NjqT18cdfo9XRKqQ4Pj+eU7jieNpsA21ygvf5L7O0hKwLxLvstdky+5Bz1uTGwE326D8a/iljVuuOXm4oms+IQqzgJjjC4sXWxcUF3/x2/FSGk0lfDqoi5v2LRtTXAnUWZMPw8FVJmeOkO9NA63f6IYyKVNlKg2GATucXjippZ8H7RgUuZ+GjC99dIZZlM8fCuIpbtUlvqpz3vS5CbLqqshoeWiqA9hLoqwaXW7Fw8ufS/nl3voFnUJRuBT/5fi6zBUspEs/DyhSVG/nrTO5LtPFf16DQE9WhimuOHRIwWWPd+WP6aML3Oft875T3EMz5ThH3NC6Qx85MD8b0AZF24sN4A9ESbfUUpSPxeWUuIY5vQKipIN3oUNevCqkCtjiL2FoodkDRJYovtKnrzarrlnzVSBOaFNfdXhR8wV7zLQ3gKy+qYDdoppToQQTtE/GOhgmUrAHpVico6uEmfTuDz9ASi6jhWjs1wKb3T2OQrxiaBPo7tKZxqYB0Aqh+8xg9MgFncPiInNJg4EBbLr4xw3uJX/oPwZToKFBAstYU3ACYtMinrtNUHsGAfi859I3V9WSN5ViQa8m5yxn5zqwHJ5faGVmS7oHq9iyfuEaIoQrkrxNPveZFttPyC02dv/dcoXJFDUkvvqk3n+Ls=----ATTACHMENT:----Mjc0OTI5NTkwMDYzMTY4IDc1NTczMTE0MTk1NzcwODggOTQ3MDA2Nzc4NDkzNzM4OQ==