Ejemplo n.º 1
0
 public function getCouponsCollection()
 {
     $json = __DIR__ . '/../Coupon/coupons.json';
     $array = json_decode(file_get_contents($json), true);
     $collection = new CouponCollection();
     $collection->import($array);
     return $collection;
 }
Ejemplo n.º 2
0
 public function testGetCoupon()
 {
     $collection = new CouponCollection();
     $coupon = new Coupon();
     $coupon->setCode('BLACK');
     $collection->addCoupon($coupon);
     $coupon = new Coupon();
     $coupon->setCode('CYBER');
     $collection->addCoupon($coupon);
     $coupon = new Coupon();
     $coupon->setCode('HANUKA');
     $collection->addCoupon($coupon);
     $this->assertInstanceOf('\\Cart\\Coupon\\Coupon', $collection->getCoupon('BLACK'));
     $this->assertInstanceOf('\\Cart\\Coupon\\Coupon', $collection->getCoupon('CYBER'));
     $this->assertInstanceOf('\\Cart\\Coupon\\Coupon', $collection->getCoupon('HANUKA'));
 }