Пример #1
0
 public function testNovelBook()
 {
     $name = '追风筝的人';
     $price = 29.0;
     $author = 'Khaled Hosseini';
     $book = new NovelBook($name, $price, $author);
     $this->assertEquals($name, $book->getName());
     $this->assertEquals($price, $book->getPrice());
     $this->assertEquals($author, $book->getAuthor());
 }
Пример #2
0
 /**
  * [getPrice description]
  * @return [type] [description]
  * @override NovelBook\getPrice()
  */
 public function getPrice() : float
 {
     $oldPrice = parent::getPrice();
     if ($oldPrice < 80) {
         $newPrice = $oldPrice * 90 / 100;
     } else {
         if (80 < $oldPrice && $oldPrice <= 300) {
             $newPrice = $oldPrice * 80 / 100;
         } else {
             $newPrice = $oldPrice * 50 / 100;
         }
     }
     return $newPrice;
 }