public function NumberPatternTest::testDelete in Commerce Core 8.2
Tests deleting a number pattern.
File
- modules/
number_pattern/ tests/ src/ FunctionalJavascript/ NumberPatternTest.php, line 95
Class
- NumberPatternTest
- Tests the number pattern admin UI.
Namespace
Drupal\Tests\commerce_number_pattern\FunctionalJavascriptCode
public function testDelete() {
$number_pattern = NumberPattern::create([
'id' => 'foo',
'label' => 'Foo',
'targetEntityType' => 'entity_test_with_store',
'plugin' => 'yearly',
'configuration' => [
'initial_number' => 10,
'padding' => 2,
],
]);
$number_pattern
->save();
$this
->drupalGet($number_pattern
->toUrl('delete-form'));
$this
->assertSession()
->pageTextContains(t('Are you sure you want to delete the number pattern @type?', [
'@type' => $number_pattern
->label(),
]));
$this
->assertSession()
->pageTextContains('This action cannot be undone.');
$this
->submitForm([], 'Delete');
$number_pattern_exists = (bool) NumberPattern::load($number_pattern
->id());
$this
->assertEmpty($number_pattern_exists);
}