public function test_checkCategoriesExistence() { /** === Test Data === */ $ODOO_1 = 21; $ODOO_2 = 22; $MAGE_1 = 31; $MAGE_2 = 32; $IDS = [$ODOO_1, $ODOO_2]; /** === Setup Mocks === */ $this->obj = \Mockery::mock(Category::class . '[createMageCategory]', [$this->mManObj, $this->mMageRepoProd, $this->mMageRepoCat, $this->mMageRepoCatLink, $this->mRepoRegistry]); // $mageId = $this->_repoRegistry->getCategoryMageIdByOdooId($odooId); $this->mRepoRegistry->shouldReceive('getCategoryMageIdByOdooId')->once()->with($ODOO_1)->andReturn($MAGE_1); $this->mRepoRegistry->shouldReceive('getCategoryMageIdByOdooId')->once()->with($ODOO_2)->andReturn(null); // $mageId = $this->createMageCategory('Cat #' . $odooId); $this->obj->shouldReceive('createMageCategory')->once()->andReturn($MAGE_2); // $this->_repoRegistry->registerCategory($mageId, $odooId); $this->mRepoRegistry->shouldReceive('registerCategory')->once()->with($MAGE_2, $ODOO_2); /** === Call and asserts === */ $this->obj->checkCategoriesExistence($IDS); }