public function PriceListTest::testDelete in Commerce Pricelist 8.2
Tests deleting a price list.
File
- tests/
src/ Functional/ PriceListTest.php, line 144
Class
- PriceListTest
- Tests the price list UI.
Namespace
Drupal\Tests\commerce_pricelist\FunctionalCode
public function testDelete() {
$price_list = $this
->createEntity('commerce_pricelist', [
'type' => 'commerce_product_variation',
'name' => $this
->randomMachineName(8),
]);
$this
->drupalGet($price_list
->toUrl('delete-form'));
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->pageTextContains('This action cannot be undone.');
$this
->submitForm([], t('Delete'));
\Drupal::service('entity_type.manager')
->getStorage('commerce_pricelist')
->resetCache([
$price_list
->id(),
]);
$price_list_exists = (bool) PriceList::load($price_list
->id());
$this
->assertFalse($price_list_exists);
}