本文整理汇总了PHP中Movie::getPriceCode方法的典型用法代码示例。如果您正苦于以下问题:PHP Movie::getPriceCode方法的具体用法?PHP Movie::getPriceCode怎么用?PHP Movie::getPriceCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Movie
的用法示例。
在下文中一共展示了Movie::getPriceCode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testPriceCode
public function testPriceCode()
{
$sw = new Movie('Star Wars', Movie::REGULAR);
$this->assertEquals(Movie::REGULAR, $sw->getPriceCode());
$toystory = new Movie('Toy Story', Movie::CHILDREN);
$this->assertEquals(Movie::CHILDREN, $toystory->getPriceCode());
$skyfall = new Movie('Skyfall', Movie::NEW_RELEASE);
$this->assertEquals(Movie::NEW_RELEASE, $skyfall->getPriceCode());
}
示例2: Movie
$sw = new Movie('Star Wars', Movie::REGULAR);
expect($sw->getTitle())->toBe('Star Wars');
});
});
describe("->getPriceCode()", function () {
it("returns the `Movie::REGULAR` price for regular movies", function () {
$sw = new Movie('Star Wars', Movie::REGULAR);
expect($sw->getPriceCode())->toBe(Movie::REGULAR);
});
it("returns the `Movie::CHILDREN` price for children's movies", function () {
$toystory = new Movie('Toy Story', Movie::CHILDREN);
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 () {