/** * Delete category * * @param CatalogCategory $category * @return void */ public function test(CatalogCategory $category) { $category->persist(); $this->catalogCategoryIndex->open(); $this->catalogCategoryIndex->getTreeCategories()->selectCategory($category); $this->catalogCategoryEdit->getFormPageActions()->delete(); }
/** * Test for update category * * @param Category $category * @param Category $initialCategory * @return void */ public function test(Category $category, Category $initialCategory) { $this->catalogCategoryIndex->open(); $this->catalogCategoryIndex->getTreeCategories()->selectCategory($initialCategory); $this->catalogCategoryEdit->getEditForm()->fill($category); $this->catalogCategoryEdit->getFormPageActions()->save(); }
/** * Assert that displayed category data on edit page equals passed from fixture. * * @param CatalogCategoryIndex $catalogCategoryIndex * @param CatalogCategoryEdit $catalogCategoryEdit * @param Category $category * @return void */ public function processAssert(CatalogCategoryIndex $catalogCategoryIndex, CatalogCategoryEdit $catalogCategoryEdit, Category $category) { $catalogCategoryIndex->open(); $catalogCategoryIndex->getTreeCategories()->selectCategory($category, true); $fixtureData = $this->prepareFixtureData($category->getData()); $formData = $catalogCategoryEdit->getEditForm()->getData($category); $error = $this->verifyData($this->sortData($fixtureData), $this->sortData($formData)); \PHPUnit_Framework_Assert::assertEmpty($error, $error); }
/** * Delete category. * * @param Category $category * @return void */ public function test(Category $category) { $category->persist(); $this->catalogCategoryIndex->open(); $this->catalogCategoryIndex->getTreeCategories()->selectCategory($category); if ($this->catalogCategoryEdit->getFormPageActions()->checkDeleteButton()) { $this->catalogCategoryEdit->getFormPageActions()->delete(); $this->catalogCategoryEdit->getModalBlock()->acceptAlert(); } }
/** * Assert that after delete a category "You deleted the category." successful message appears * * @param CatalogCategoryEdit $categoryEdit * @return void */ public function processAssert(CatalogCategoryEdit $categoryEdit) { $actualMessage = $categoryEdit->getMessagesBlock()->getSuccessMessage(); \PHPUnit_Framework_Assert::assertEquals(self::SUCCESS_DELETE_MESSAGE, $actualMessage, 'Wrong success delete message is displayed.' . "\nExpected: " . self::SUCCESS_DELETE_MESSAGE . "\nActual: " . $actualMessage); }
/** * Assert that Delete button is not available. * * @param CatalogCategoryEdit $catalogCategoryEdit * @return void */ public function processAssert(CatalogCategoryEdit $catalogCategoryEdit) { \PHPUnit_Framework_Assert::assertEquals($catalogCategoryEdit->getFormPageActions()->checkDeleteButton(), false, 'Delete button is available for the category.'); }