public function test_getByOdooId() { /** === Test Data === */ $id = 1; /** === Call and asserts === */ $res = $this->obj->getByOdooId($id); $this->assertNotNull($res); }
public function test_getByOdooId() { /** === Test Data === */ $ODOO_ID = null; $DATA = [AggLot::AS_ODOO_ID => $ODOO_ID]; /** === Mock object itself === */ $this->obj = \Mockery::mock(\Praxigento\Odoo\Repo\Agg\Def\Lot::class . '[_checkNullLot]', $this->objArgs); /** === Setup Mocks === */ // $this->_checkNullLot(); $this->obj->shouldReceive('_checkNullLot')->once(); // // $query = $this->_factorySelect->getQueryToSelect(); $mQuery = $this->_mockDbSelect(); $this->mFactorySelect->shouldReceive('getQueryToSelect')->once()->andReturn($mQuery); // $query->where($where); $mQuery->shouldReceive('where')->once(); // $data = $this->_conn->fetchRow($query, ['id' => $id]); $this->mConn->shouldReceive('fetchRow')->once()->andReturn($DATA); // $result = $this->_manObj->create(AggWarehouse::class); $this->mManObj->shouldReceive('create')->once()->andReturn(new AggLot()); /** === Call and asserts === */ $res = $this->obj->getByOdooId($ODOO_ID); $this->assertEquals($ODOO_ID, $res->getOdooId()); }