diff --git a/src/entity/currency/Euro.php b/src/entity/currency/Euro.php new file mode 100644 index 0000000..8b684c8 --- /dev/null +++ b/src/entity/currency/Euro.php @@ -0,0 +1,42 @@ +cents; + } + + public function setCents(int $cents): void + { + $this->cents = $cents; + } + + public function getFloat(): float + { + return ($this->cents/100); + } + + public function getSymbol(): string + { + return '€'; + } +} + diff --git a/src/entity/currency/EuroTest.php b/src/entity/currency/EuroTest.php new file mode 100644 index 0000000..4c253c8 --- /dev/null +++ b/src/entity/currency/EuroTest.php @@ -0,0 +1,43 @@ +euro = new Euro(); + $this->euro->setCents(self::CENTS); + } + + public function testName():void{ + $this->assertEquals('Euro', $this->euro->getName()); + } + + public function testSymbol():void{ + $this->assertEquals('€', $this->euro->getSymbol()); + } + + public function testCent():void{ + $this->assertEquals(self::CENTS, $this->euro->getCents()); + } + + public function testFloat():void{ + $this->assertEquals(self::FLOAT, $this->euro->getFloat()); + } +} +