protected function checkTaxTypeDeleteForm($name) { $edit = ['confirm' => '1']; $this->assertTrue((bool) TaxType::load($name)); $this->drupalPostForm('admin/commerce/config/tax/type/' . $name . '/delete', $edit, t('Delete')); $this->assertFalse((bool) TaxType::load($name)); }
/** * Tests deleting a tax type via a form. */ public function testTaxTypeDeletion() { $values = ['id' => strtolower($this->randomMachineName(5)), 'name' => $this->randomMachineName(5), 'zone' => $this->createZone()->getId()]; $tax_type = $this->createEntity('commerce_tax_type', $values); $this->drupalGet('admin/commerce/config/tax-types/' . $tax_type->id() . '/delete'); $this->assertResponse(200, 'The tax type delete form can be accessed.'); $this->assertText(t('This action cannot be undone.'), 'The tax type delete confirmation form is available'); $this->drupalPostForm(NULL, NULL, t('Delete')); $tax_type_exists = (bool) TaxType::load($tax_type->id()); $this->assertFalse($tax_type_exists, 'The tax type has been deleted form the database.'); }