public function testSetExternalIdEmptyString() { $item = new CheckoutItem(1, 'yolo'); try { $item->setExternalId(''); $this->fail(); } catch (\InvalidArgumentException $expected) { } }
public static function fromJson($json) { $r = new CheckoutItem(); $r->setCount($json->count); $r->setName(isset($json->name) ? $json->name : null); $r->setSku($json->sku); $r->setExternalId(isset($json->external_id) ? $json->external_id : null); $r->setPrice(Price::fromJson($json->price)); $r->setTotal(Price::fromJson($json->total)); return $r; }