public function CatalogTest::testCatalogRepair in Ubercart 8.4
Tests the catalog repair function.
File
- uc_catalog/
tests/ src/ Functional/ CatalogTest.php, line 136
Class
- CatalogTest
- Tests for the Ubercart catalog.
Namespace
Drupal\Tests\uc_catalog\FunctionalCode
public function testCatalogRepair() {
/** @var \Drupal\Tests\WebAssert $assert */
$assert = $this
->assertSession();
$this
->drupalLogin($this->adminUser);
$this
->drupalGet('admin/structure/types/manage/product/fields/node.product.taxonomy_catalog/delete');
$this
->submitForm([], 'Delete');
// Check that catalog taxonomy term reference field was deleted.
$assert
->pageTextContains('The field Catalog has been deleted from the Product content type.');
$this
->drupalGet('admin/structure/types/manage/product/fields');
// Check that catalog taxonomy term reference field does not exist.
$assert
->pageTextNotContains('taxonomy_catalog');
$this
->drupalGet('admin/store');
// Check that store status message mentions the missing field.
$assert
->pageTextContains('The catalog taxonomy reference field is missing.');
$this
->drupalGet('admin/store/config/catalog/repair');
// Check that repair message is displayed.
$assert
->pageTextContains('The catalog taxonomy reference field has been repaired.');
$this
->drupalGet('admin/structure/types/manage/product/fields');
// Check that catalog taxonomy term reference field exists.
$assert
->pageTextContains('taxonomy_catalog');
}