public function test_productSave() { /** === Test Data === */ $BUNDLE = new \Praxigento\Odoo\Data\Odoo\Inventory(); $mProd = new \Praxigento\Odoo\Data\Odoo\Inventory\Product(); $BUNDLE->setProducts([$mProd]); /** === Mock object itself === */ $this->obj = \Mockery::mock(Call::class . '[_doProductReplication]', $this->objArgs); /** === Setup Mocks === */ // $def = $this->_manTrans->begin(); $mDef = $this->_mockTransactionDefinition(); $this->mManTrans->shouldReceive('begin')->once()->andReturn($mDef); // $this->_doProductReplication($bundle); $this->obj->shouldReceive('_doProductReplication')->once(); // $this->_manTrans->commit($def); $this->mManTrans->shouldReceive('commit')->once(); // $this->_manTrans->end($def); $this->mManTrans->shouldReceive('end')->once(); /** === Call and asserts === */ $req = new Request\ProductSave(); $req->setProductBundle($BUNDLE); $res = $this->obj->productSave($req); $this->assertTrue($res->isSucceed()); }