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


PHP Movie::getPriceCode方法代码示例

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

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


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