Beispiel #1
0
 public function testPayload()
 {
     $price = new Price();
     $plan = new Plan();
     foreach ($this->payload as $testCase) {
         echo "Testing case: " . json_encode($testCase) . "\n";
         $price->setPricePerMinute($testCase["price"]["ppm"]);
         $plan->setMinutes($testCase["plan"]["min"]);
         $plan->setFareAdditionalMin($testCase["plan"]["fare"]);
         $this->assertEquals($plan->calculateCallCost($price, $testCase["duration"]), $testCase["result"]);
     }
 }
Beispiel #2
0
 private function toObject($row)
 {
     $obj = new Plan();
     if (isset($row["plan_id"])) {
         $obj->setPlanId($row["plan_id"]);
     }
     if (isset($row["description"])) {
         $obj->setDescription($row["description"]);
     }
     if (isset($row["minutes"])) {
         $obj->setMinutes($row["minutes"]);
     }
     if (isset($row["fare_additional_min"])) {
         $obj->setFareAdditionalMin($row["fare_additional_min"]);
     }
     return $obj;
 }