public function PromotionTest::testDeletePromotion in Commerce Core 8.2
Tests deleting a promotion.
File
- modules/
promotion/ tests/ src/ FunctionalJavascript/ PromotionTest.php, line 406
Class
- PromotionTest
- Tests the admin UI for promotions.
Namespace
Drupal\Tests\commerce_promotion\FunctionalJavascriptCode
public function testDeletePromotion() {
$promotion = $this
->createEntity('commerce_promotion', [
'name' => $this
->randomMachineName(8),
]);
$this
->drupalGet($promotion
->toUrl('delete-form'));
$this
->assertSession()
->pageTextContains('This action cannot be undone.');
$this
->submitForm([], t('Delete'));
$this->container
->get('entity_type.manager')
->getStorage('commerce_promotion')
->resetCache([
$promotion
->id(),
]);
$promotion_exists = (bool) Promotion::load($promotion
->id());
$this
->assertEmpty($promotion_exists);
}