/** * @Given I create root category :arg1 */ public function iCreateRootCategory($arg1) { $rootCategory = $this->categoryRepository->findRootCategory(); if ($rootCategory) { throw new \Exception('Root category exist with name ', $rootCategory->getName()); } $category = new Category($arg1, true); $this->categoryRepository->add($category); }