public function PaymentStatusWebTest::testList in Payment 8.2
Tests listing.
File
- tests/
src/ Functional/ Controller/ PaymentStatusWebTest.php, line 44
Class
- PaymentStatusWebTest
- Payment status UI.
Namespace
Drupal\Tests\payment\Functional\ControllerCode
public function testList() {
$payment_status_id = strtolower($this
->randomMachineName());
/** @var \Drupal\payment\Entity\PaymentStatusInterface $status */
$status = $this->paymentStatusStorage
->create([]);
$status
->setId($payment_status_id)
->setLabel($this
->randomMachineName())
->save();
$path = 'admin/config/services/payment/status';
$this
->drupalGet($path);
$this
->assertResponse(403);
$this
->drupalLogin($this
->drupalCreateUser(array(
'payment.payment_status.administer',
)));
$this
->drupalGet($path);
$this
->assertResponse(200);
// Assert that the "Add payment status" link is visible.
$this
->assertLinkByHref('admin/config/services/payment/status/add');
// Assert that all plugins are visible.
$manager = Payment::statusManager();
foreach ($manager
->getDefinitions() as $definition) {
$this
->assertText($definition['label']);
if ($definition['description']) {
$this
->assertText($definition['description']);
}
}
// Assert that all config entity operations are visible.
$this
->assertLinkByHref('admin/config/services/payment/status/edit/' . $payment_status_id);
$this
->assertLinkByHref('admin/config/services/payment/status/delete/' . $payment_status_id);
}