Exemple #1
0
 public function testDealFromApiArray()
 {
     $d = new Deal();
     $data = json_decode(self::$VALID_TEST_JSON, true);
     $d->fromApiArray($data);
     $this->assertEquals($data['name'], $d->getName());
     $this->assertEquals($data['motivation']['title'], $d->getMotivationTitle());
     $this->assertEquals($data['motivation']['text'], $d->getMotivationText());
     $this->assertEquals($data['spread']['title'], $d->getSpreadTitle());
     $this->assertEquals($data['spread']['text'], $d->getSpreadText());
     $this->assertEquals($data['spread']['url'], $d->getSpreadUrl());
     $this->assertEquals($data['spread']['img'], $d->getSpreadImg());
     $this->assertEquals($data['spread']['tos'], $d->getSpreadTos());
     $this->assertEquals($data['coupon']['type'], $d->getCouponType());
     $this->assertEquals($data['coupon']['title'], $d->getCouponTitle());
     $this->assertEquals($data['coupon']['text'], $d->getCouponText());
     $this->assertEquals($data['coupon']['code'], $d->getCouponCode());
     $this->assertEquals($data['coupon']['url'], $d->getCouponUrl());
     $this->assertEquals($data['coupon']['webhook_url'], $d->getCouponWebhookUrl());
     $this->assertEquals($data['coupon']['redeem_url'], $d->getCouponRedeemUrl());
     $this->assertEquals($data['billing']['type'], $d->getBillingType());
     $this->assertEquals($data['billing']['target_quantity'], $d->getTargetQuantity());
 }