Implemented image and test

This commit is contained in:
Kevin Frantz 2018-07-14 13:20:37 +02:00
parent ac7d0aae21
commit 782c0e511e
2 changed files with 53 additions and 6 deletions

View File

@ -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;
}
}

View File

@ -0,0 +1,33 @@
<?php
namespace entity\image;
use PHPUnit\Framework\TestCase;
/**
*
* @author kevinfrantz
*
*/
class UrlImageTest extends TestCase
{
const IMAGE_URL = 'http://dummy.image/test.jpg';
/**
* @var UrlImage
*/
protected $urlImage;
protected function setUp():void{
$this->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());
}
}