From b3ccde879d801e8858ec5163ef7bd323dafdb8f8 Mon Sep 17 00:00:00 2001 From: Oliver Vogel Date: Tue, 20 Jan 2015 17:44:25 +0100 Subject: [PATCH] added getBackups method --- src/Intervention/Image/Image.php | 10 ++++++++++ tests/ImageTest.php | 10 +++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/Intervention/Image/Image.php b/src/Intervention/Image/Image.php index 5184676b..8cb26f42 100644 --- a/src/Intervention/Image/Image.php +++ b/src/Intervention/Image/Image.php @@ -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 * diff --git a/tests/ImageTest.php b/tests/ImageTest.php index 184844d7..ee76473a 100644 --- a/tests/ImageTest.php +++ b/tests/ImageTest.php @@ -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); }