本文整理汇总了PHP中Movie::getCharge方法的典型用法代码示例。如果您正苦于以下问题:PHP Movie::getCharge方法的具体用法?PHP Movie::getCharge怎么用?PHP Movie::getCharge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Movie
的用法示例。
在下文中一共展示了Movie::getCharge方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testChargeChildren
public function testChargeChildren()
{
$toystory = new Movie('Toy Story', Movie::CHILDREN);
$this->assertEquals(1.5, $toystory->getCharge(2));
$this->assertEquals(1.5, $toystory->getCharge(3));
$this->assertEquals(3, $toystory->getCharge(4));
}
示例2: expect
expect($toystory->getPriceCode())->toBe(Movie::CHILDREN);
});
it("returns the `Movie::NEW_RELEASE` price for newly released movies", function () {
$skyfall = new Movie('Skyfall', Movie::NEW_RELEASE);
expect($skyfall->getPriceCode())->toBe(Movie::NEW_RELEASE);
});
it("throws an `InvalidArgumentException` when using an invalid price code", function () {
$closure = function () {
$killbill = new Movie('Kill Bill', 999);
};
expect($closure)->toThrow(new InvalidArgumentException("Incorrect Price Code"));
});
});
describe("->getCharge()", function () {
it("gets regular movie charge", function () {
$sw = new Movie('Star Wars', Movie::REGULAR);
expect($sw->getCharge(1))->toBe(2);
expect($sw->getCharge(3))->toBe(3.5);
});
it("gets children movie charge", function () {
$toystory = new Movie('Toy Story', Movie::CHILDREN);
expect($toystory->getCharge(2))->toBe(1.5);
expect($toystory->getCharge(3))->toBe(1.5);
expect($toystory->getCharge(4))->toBe(3.0);
});
it("gets new released movie charge", function () {
$skyfall = new Movie('Skyfall', Movie::NEW_RELEASE);
expect($skyfall->getCharge(2))->toBe(6);
});
});
});
示例3: getCharge
public function getCharge()
{
return $this->movie->getCharge($this->daysRented);
}