/** * Tests deleting a address format for countryCode = ZZ via a form and from the API. */ function testAddressFormatDeleteZZ() { $countryCode = 'ZZ'; $this->drupalGet('admin/config/regional/address-formats/manage/' . $countryCode . '/delete'); $this->assertResponse(403, "The delete form for the 'ZZ' address format cannot be accessed."); // Try deleting ZZ from the API $addressFormat = AddressFormat::load($countryCode); try { $addressFormat->delete(); $this->fail("The 'ZZ' address format can't be deleted."); } catch (EntityStorageException $e) { $this->assertEqual("The 'ZZ' address format can't be deleted.", $e->getMessage()); } }
/** * Tests deleting a address format for countryCode = ZZ via a form and from the API. */ function testAddressFormatDeleteZZ() { $country_code = 'ZZ'; $this->drupalGet('admin/config/regional/address-formats/manage/' . $country_code . '/delete'); $this->assertSession()->statusCodeEquals(403); // Try deleting ZZ from the API $address_format = AddressFormat::load($country_code); try { $address_format->delete(); $this->fail("The 'ZZ' address format can't be deleted."); } catch (EntityStorageException $e) { $this->assertEquals("The 'ZZ' address format can't be deleted.", $e->getMessage()); } }