/** * add a shipping * * @param array $shipping * @return bool */ public function addShipping($shipping) { $model = new Shipping($shipping); if ($model->validate()) { $this->shipping[] = $shipping; return true; } $this->errors = $model->errors; return false; }
/** * test whether shipping is created with given values */ public function testCreate() { $model = new Shipping(['name' => 'Shipping to someone else', 'value' => 1000, 'payee_code' => 'abcdefABCDEF0123456789abcdefABCD']); $this->assertTrue($model->validate()); }