public function PaymentStatusWebTest::testDelete in Payment 8.2
Tests deleting a payment status.
File
- tests/
src/ Functional/ Controller/ PaymentStatusWebTest.php, line 138
Class
- PaymentStatusWebTest
- Payment status UI.
Namespace
Drupal\Tests\payment\Functional\ControllerCode
public function testDelete() {
$payment_status_id = strtolower($this
->randomMachineName());
/** @var \Drupal\payment\Entity\PaymentStatusInterface $status */
$status = $this->paymentStatusStorage
->create([]);
$status
->setId($payment_status_id)
->save();
$path = 'admin/config/services/payment/status/delete/' . $payment_status_id;
$this
->drupalGet($path);
$this
->assertResponse(403);
$this
->drupalLogin($this
->drupalCreateUser(array(
'payment.payment_status.administer',
)));
$this
->drupalGet($path);
$this
->assertResponse(200);
$this
->drupalPostForm(NULL, [], t('Delete'));
$this
->assertNull($this->paymentStatusStorage
->loadUnchanged($payment_status_id));
}