public function testPayload() { $p = new Price(); foreach ($this->payload as $testCase) { echo "Testing case: " . json_encode($testCase) . "\n"; $p->setPricePerMinute($testCase["ppm"]); $this->assertEquals($p->calculateCallCost($testCase["duration"]), $testCase["result"]); } }
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"]); } }
private function toObject($row) { $obj = new Price(); if (isset($row["from_ddd"])) { $obj->setFromDDD($row["from_ddd"]); } if (isset($row["to_ddd"])) { $obj->setToDDD($row["to_ddd"]); } if (isset($row["price_per_minute"])) { $obj->setPricePerMinute($row["price_per_minute"]); } return $obj; }