public function test_create() { $bind = [DataEntity::ATTR_ASSET_TYPE_ID => 1, DataEntity::ATTR_CUST_ID => 1]; $res = $this->_obj->create($bind); $this->assertTrue($res > 0); $bind = [DataEntityOther::ATTR_TYPE_ID => 1]; $res = $this->_obj2->create($bind); $this->assertTrue($res > 0); }
public function test_create() { /** === Test Data === */ $DATA = ['field' => 'value']; $ID = 'inserted'; /** === Setup Mocks === */ // $result = $this->_repoGeneric->addEntity($this->_entityName, $data); $this->mRepoGeneric->shouldReceive('addEntity')->once()->with($this->ENTITY_NAME, $DATA)->andReturn($ID); /** === Call and asserts === */ $res = $this->obj->create($DATA); $this->assertEquals($ID, $res); }
public function create($data) { $result = parent::create($data); if ($result) { /* update balalnces for accounts */ if (is_array($data)) { $data = new Entity($data); } $value = $data->getValue(); $creditAccid = $data->getCreditAccId(); $debitAccId = $data->getDebitAccId(); $this->_repoAccount->updateBalance($creditAccid, 0 + $value); $this->_repoAccount->updateBalance($debitAccId, 0 - $value); } return $result; }
public function create($data) { return parent::create($data); // TODO: Change the autogenerated stub }