1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-01 11:30:16 +02:00

added tests

This commit is contained in:
Oliver Vogel
2015-01-20 17:43:49 +01:00
parent 666475912c
commit bd654f9ca2

View File

@@ -63,6 +63,40 @@ class ImageTest extends PHPUnit_Framework_TestCase
$this->assertEquals('./tmp/foo.png', $image->basePath());
}
/**
* @expectedException \Intervention\Image\Exception\RuntimeException
*/
public function testGetBackupWithoutBackuo()
{
$image = $this->getTestImage();
$image->getBackup();
}
public function testSetGetBackup()
{
$image = $this->getTestImage();
$image->setBackup('foo');
$backup = $image->getBackup();
$this->assertEquals('foo', $backup);
}
public function testGetAllBackups()
{
$image = $this->getTestImage();
$image->setBackup('foo');
$image->setBackup('bar');
$image->setBackup('baz');
$backups = $image->getAllBackups();
$this->assertEquals(array('default' => 'baz'), $backups);
$image = $this->getTestImage();
$image->setBackup('foo', 'a');
$image->setBackup('bar', 'b');
$image->setBackup('baz', 'c');
$backups = $image->getAllBackups();
$this->assertEquals(array('a' => 'foo', 'b' => 'bar', 'c' => 'baz'), $backups);
}
private function getTestImage()
{
$size = Mockery::mock('\Intervention\Image\Size', array(800, 600));