Finalized images action and loop

This commit is contained in:
franck
2013-08-15 20:47:05 +02:00
parent 5762711146
commit d61eeef0d6
24 changed files with 812 additions and 166 deletions

View File

@@ -113,7 +113,7 @@ class ImageTest extends \PHPUnit_Framework_TestCase
/**
*
* Tru to process a non-existent file
* Try to process a non-existent file
*
* @expectedException \InvalidArgumentException
*/
@@ -129,6 +129,24 @@ class ImageTest extends \PHPUnit_Framework_TestCase
$image->processImage($event);
}
/**
*
* Try to process a file outside of the cache
*
* @expectedException \InvalidArgumentException
*/
public function testProcessImageOutsideValidPath()
{
$event = new ImageEvent($this->request);
$image = new Image($this->getContainer());
$event->setCacheFilepath("blablabla.png");
$event->setCacheSubdirectory("../../../");
$image->processImage($event);
}
/**
* No operation done on source file -> copie !
*/
@@ -317,4 +335,37 @@ class ImageTest extends \PHPUnit_Framework_TestCase
$image->processImage($event);
}
public function testClearTestsCache() {
$event = new ImageEvent($this->request);
$event->setCacheSubdirectory('tests');
$image = new Image($this->getContainer());
$image->clearCache($event);
}
public function testClearWholeCache() {
$event = new ImageEvent($this->request);
$image = new Image($this->getContainer());
$image->clearCache($event);
}
/**
* Try to clear directory ouside of the cache
*
* @expectedException \InvalidArgumentException
*/
public function testClearUnallowedPathCache() {
$event = new ImageEvent($this->request);
$event->setCacheSubdirectory('../../../..');
$image = new Image($this->getContainer());
$image->clearCache($event);
}
}