public function test_create() { /** === Test Data === */ $MAGE_ID = 32; $ODOO_ID = 54; $DATA = new AggLot([AggLot::AS_ODOO_ID => $ODOO_ID]); /** === Setup Mocks === */ // $def = $this->_manTrans->begin(); $mDef = $this->_mockTransactionDefinition(); $this->mManTrans->shouldReceive('begin')->once()->andReturn($mDef); // $id = $this->_repoWrhsEntityRepoLot->create($bind); $this->mRepoWrhsEntityLot->shouldReceive('create')->once()->andReturn($MAGE_ID); // $this->_repoEntityLot->create($bind); $this->mRepoEntityLot->shouldReceive('create')->once(); // $this->_manTrans->commit($def); $this->mManTrans->shouldReceive('commit')->once(); // $result = $this->_manObj->create(AggLot::class); $this->mManObj->shouldReceive('create')->once()->andReturn(new AggLot()); // $this->_manTrans->end($def); $this->mManTrans->shouldReceive('end')->once(); /** === Call and asserts === */ $res = $this->obj->create($DATA); $this->assertEquals($MAGE_ID, $res->getId()); }