Added frames of entities and test for product

This commit is contained in:
Kevin Frantz 2018-07-14 11:21:32 +02:00
parent 0d8639cedb
commit e307c7e07e
6 changed files with 160 additions and 5 deletions

View File

@ -0,0 +1,21 @@
<?php
namespace entity\image;
/**
*
* @author kevinfrantz
*
*/
class UrlImage implements ImageInterface
{
public function getImageThumbnail(): string
{}
public function getImage(): string
{}
public function setImage(string $path): void
{}
}

View File

@ -0,0 +1,23 @@
<?php
namespace entity\price;
use entity\currency\CurrencyInterface;
/**
*
* @author kevinfrantz
*
*/
final class Price implements PriceInterface
{
public function getGross(): CurrencyInterface
{}
public function getNetto(): CurrencyInterface
{}
public function setPrice(CurrencyInterface $price): void
{}
}

View File

@ -0,0 +1,46 @@
<?php
namespace entity\product;
use entity\color\ColorInterface;
use entity\price\PriceInterface;
use entity\image\ImageInterface;
/**
*
* @author kevinfrantz
*
*/
final class Product implements ProductInterface
{
public function setName(string $name): void
{}
public function getName(): string
{}
public function setColor(ColorInterface $color): void
{}
public function getColor(): ColorInterface
{}
public function setId(int $id): void
{}
public function getId(): int
{}
public function setPrice(PriceInterface $price): void
{}
public function getImage(): ImageInterface
{}
public function getPrice(): PriceInterface
{}
public function setImage(ImageInterface $image): void
{}
}

View File

@ -59,5 +59,7 @@ interface ProductInterface
* @return int
*/
public function getId():int;
public function setId(int $id):void;
}

View File

@ -0,0 +1,68 @@
<?php
namespace entity\product;
use entity\price\Price;
use entity\image\UrlImage;
use PHPUnit\Framework\TestCase;
/**
*
* @author kevinfrantz
*
*/
class ProductTest extends TestCase
{
const COLOR = 'red';
const ID = '123';
const NAME = 'ITProduct';
/**
* @var Price
*/
protected $price;
/**
* @var Product
*/
protected $product;
/**
*
* @var UrlImage
*/
protected $image;
protected function setUp():void{
$this->product = new Product();
$this->price = new Price();
$this->image = new UrlImage();
$this->product->setImage($this->image);
$this->product->setPrice($this->price);
$this->product->setColor(self::COLOR);
$this->product->setId(self::ID);
$this->product->setName(self::NAME);
}
public function testImage():void{
$this->assertInstanceOf(UrlImage::class, $this->product->getImage());
}
public function testPrice():void{
$this->assertInstanceOf(Price::class, $this->product->getPrice());
}
public function testColor():void{
$this->assertEquals(self::COLOR, $this->product->getColor());
}
public function testId():void{
$this->assertEquals(self::ID, $this->product->getId());
}
public function testName():void{
$this->assertEquals(self::NAME, $this->product->getColor());
}
}

View File

@ -40,10 +40,5 @@ interface UserInterface
* @return string
*/
public function getEmail():string;
/**
* @return int
*/
public function getId():int;
}