mirror of
https://github.com/kevinveenbirkenbach/coding-challenge-online-shop.git
synced 2024-11-22 02:01:04 +01:00
Added frames of entities and test for product
This commit is contained in:
parent
0d8639cedb
commit
e307c7e07e
21
src/entity/image/UrlImage.php
Normal file
21
src/entity/image/UrlImage.php
Normal 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
|
||||
{}
|
||||
|
||||
}
|
||||
|
23
src/entity/price/Price.php
Normal file
23
src/entity/price/Price.php
Normal 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
|
||||
{}
|
||||
|
||||
}
|
||||
|
46
src/entity/product/Product.php
Normal file
46
src/entity/product/Product.php
Normal 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
|
||||
{}
|
||||
|
||||
}
|
||||
|
@ -59,5 +59,7 @@ interface ProductInterface
|
||||
* @return int
|
||||
*/
|
||||
public function getId():int;
|
||||
|
||||
public function setId(int $id):void;
|
||||
}
|
||||
|
||||
|
68
src/entity/product/ProductTest.php
Normal file
68
src/entity/product/ProductTest.php
Normal 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());
|
||||
}
|
||||
}
|
||||
|
@ -40,10 +40,5 @@ interface UserInterface
|
||||
* @return string
|
||||
*/
|
||||
public function getEmail():string;
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getId():int;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user