From 782c0e511ea42078022409260e47dd554d62c4cd Mon Sep 17 00:00:00 2001 From: Kevin Frantz Date: Sat, 14 Jul 2018 13:20:37 +0200 Subject: [PATCH] Implemented image and test --- src/entity/image/UrlImage.php | 26 ++++++++++++++++++------ src/entity/image/UrlImageTest.php | 33 +++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 src/entity/image/UrlImageTest.php diff --git a/src/entity/image/UrlImage.php b/src/entity/image/UrlImage.php index 95f8d3e..0f8fe0d 100644 --- a/src/entity/image/UrlImage.php +++ b/src/entity/image/UrlImage.php @@ -2,20 +2,34 @@ namespace entity\image; /** - * + * This class represents an image which is just accessible via url + * In a real application you would upload the images to the server * @author kevinfrantz * */ -class UrlImage implements ImageInterface +final class UrlImage implements ImageInterface { + private $path; + + /** + * This is just a dummy function. + * In a real application you would return here a smaller scaled image + * {@inheritDoc} + * @see \entity\image\ImageInterface::getImageThumbnail() + */ public function getImageThumbnail(): string - {} + { + return $this->path; + } public function getImage(): string - {} + { + return $this->path; + } public function setImage(string $path): void - {} - + { + $this->path = $path; + } } diff --git a/src/entity/image/UrlImageTest.php b/src/entity/image/UrlImageTest.php new file mode 100644 index 0000000..48e83af --- /dev/null +++ b/src/entity/image/UrlImageTest.php @@ -0,0 +1,33 @@ +urlImage = new UrlImage(); + $this->urlImage->setImage(self::IMAGE_URL); + } + + public function testImage():void{ + $this->assertEquals(self::IMAGE_URL, $this->urlImage->getImage()); + } + + public function testThumbnail():void{ + $this->assertEquals(self::IMAGE_URL, $this->urlImage->getImageThumbnail()); + } +} +