public function getCouponsCollection() { $json = __DIR__ . '/../Coupon/coupons.json'; $array = json_decode(file_get_contents($json), true); $collection = new CouponCollection(); $collection->import($array); return $collection; }
public function testImport() { $json = __DIR__ . '/coupons.json'; $array = json_decode(file_get_contents($json), true); $collection = new CouponCollection(); $collection->import($array); //file_put_contents($json, json_encode($collection, \JSON_PRETTY_PRINT)); $this->assertEquals($array, $collection->toArray()); $this->assertInternalType('array', $collection->toArray()); }