1
0
mirror of https://github.com/Intervention/image.git synced 2025-01-17 12:18:14 +01:00

added getBackups method

This commit is contained in:
Oliver Vogel 2015-01-20 17:44:25 +01:00
parent bd654f9ca2
commit b3ccde879d
2 changed files with 17 additions and 3 deletions

View File

@ -219,6 +219,16 @@ class Image extends File
return $this->backups[$name];
}
/**
* Returns all backups attached to image
*
* @return array
*/
public function getBackups()
{
return $this->backups;
}
/**
* Sets current image backup
*

View File

@ -80,20 +80,24 @@ class ImageTest extends PHPUnit_Framework_TestCase
$this->assertEquals('foo', $backup);
}
public function testGetAllBackups()
public function testGetBackups()
{
$image = $this->getTestImage();
$backups = $image->getBackups();
$this->assertEquals(array(), $backups);
$image = $this->getTestImage();
$image->setBackup('foo');
$image->setBackup('bar');
$image->setBackup('baz');
$backups = $image->getAllBackups();
$backups = $image->getBackups();
$this->assertEquals(array('default' => 'baz'), $backups);
$image = $this->getTestImage();
$image->setBackup('foo', 'a');
$image->setBackup('bar', 'b');
$image->setBackup('baz', 'c');
$backups = $image->getAllBackups();
$backups = $image->getBackups();
$this->assertEquals(array('a' => 'foo', 'b' => 'bar', 'c' => 'baz'), $backups);
}