mirror of
https://github.com/Intervention/image.git
synced 2025-08-06 13:56:30 +02:00
added getBackups method
This commit is contained in:
@@ -219,6 +219,16 @@ class Image extends File
|
|||||||
return $this->backups[$name];
|
return $this->backups[$name];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns all backups attached to image
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getBackups()
|
||||||
|
{
|
||||||
|
return $this->backups;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets current image backup
|
* Sets current image backup
|
||||||
*
|
*
|
||||||
|
@@ -80,20 +80,24 @@ class ImageTest extends PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals('foo', $backup);
|
$this->assertEquals('foo', $backup);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetAllBackups()
|
public function testGetBackups()
|
||||||
{
|
{
|
||||||
|
$image = $this->getTestImage();
|
||||||
|
$backups = $image->getBackups();
|
||||||
|
$this->assertEquals(array(), $backups);
|
||||||
|
|
||||||
$image = $this->getTestImage();
|
$image = $this->getTestImage();
|
||||||
$image->setBackup('foo');
|
$image->setBackup('foo');
|
||||||
$image->setBackup('bar');
|
$image->setBackup('bar');
|
||||||
$image->setBackup('baz');
|
$image->setBackup('baz');
|
||||||
$backups = $image->getAllBackups();
|
$backups = $image->getBackups();
|
||||||
$this->assertEquals(array('default' => 'baz'), $backups);
|
$this->assertEquals(array('default' => 'baz'), $backups);
|
||||||
|
|
||||||
$image = $this->getTestImage();
|
$image = $this->getTestImage();
|
||||||
$image->setBackup('foo', 'a');
|
$image->setBackup('foo', 'a');
|
||||||
$image->setBackup('bar', 'b');
|
$image->setBackup('bar', 'b');
|
||||||
$image->setBackup('baz', 'c');
|
$image->setBackup('baz', 'c');
|
||||||
$backups = $image->getAllBackups();
|
$backups = $image->getBackups();
|
||||||
$this->assertEquals(array('a' => 'foo', 'b' => 'bar', 'c' => 'baz'), $backups);
|
$this->assertEquals(array('a' => 'foo', 'b' => 'bar', 'c' => 'baz'), $backups);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user