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:
parent
bd654f9ca2
commit
b3ccde879d
@ -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
|
||||
*
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user