public function test_processWarehouses_success() { /** === Test Data === */ $WRHS = new \Praxigento\Odoo\Data\Odoo\Inventory\Warehouse(); $WRHSS = [$WRHS]; $ID = 4; /** === Setup Mocks === */ // $found = $this->_repoAggWrhs->getByOdooId($odooId); $this->mRepoAggWrhs->shouldReceive('getByOdooId')->once()->andReturn(false); // $aggData = $this->_manObj->create(AggWarehouse::class); $mAggData = new \Praxigento\Odoo\Data\Agg\Warehouse(); $this->mManObj->shouldReceive('create')->once()->andReturn($mAggData); // $created = $this->_repoAggWrhs->create($aggData); $this->mRepoAggWrhs->shouldReceive('create')->once()->andReturn($mAggData); // if (!$created->getId()) {} $mAggData->setId($ID); /** === Call and asserts === */ $this->obj->processWarehouses($WRHSS); }
} switch ($fieldType) { case 'decimal': case 'bit': return false; default: return true; } } private function convertBoolean($value) { if ($value == 'true') { return 1; } else { return 0; } } private function convertDatetime($value) { return empty($value) ? 'NULL' : date("Y-m-d H:i:s", strtotime($value)); } private function convertDecimal($value) { return $value === '' ? 'NULL' : $value; } } if (!count(debug_backtrace())) { // only run if being called directly $r = new Replicator(); $r->syncData(); }