当前位置: 首页>>代码示例>>PHP>>正文


PHP Movie::getCharge方法代码示例

本文整理汇总了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));
 }
开发者ID:jails,项目名称:refactoring-php-example,代码行数:7,代码来源:MovieTest.php

示例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);
        });
    });
});
开发者ID:jails,项目名称:refactoring-php-example,代码行数:31,代码来源:MovieSpec.php

示例3: getCharge

 public function getCharge()
 {
     return $this->movie->getCharge($this->daysRented);
 }
开发者ID:svyandun,项目名称:refactoring,代码行数:4,代码来源:Rental.php


注:本文中的Movie::getCharge方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。