public function CartCheckoutTest::testCheckoutBlockedUser in Ubercart 8.4
Tests blocked user checkout.
File
- uc_cart/
tests/ src/ Functional/ CartCheckoutTest.php, line 472
Class
- CartCheckoutTest
- Tests the cart and checkout functionality.
Namespace
Drupal\Tests\uc_cart\FunctionalCode
public function testCheckoutBlockedUser() {
/** @var \Drupal\Tests\WebAssert $assert */
$assert = $this
->assertSession();
// Block user after checkout.
$settings = [
'uc_new_customer_status_active' => FALSE,
];
$this
->drupalLogin($this->adminUser);
$this
->drupalGet('admin/store/config/checkout');
$this
->submitForm($settings, 'Save configuration');
$this
->drupalLogout();
// Test as anonymous user.
$this
->addToCart($this->product);
$this
->checkout();
$assert
->responseContains('Your order is complete!');
// Test new account email.
$mails = $this
->getMails([
'id' => 'user_register_pending_approval',
]);
$this
->assertNotEmpty($mails, 'Blocked user email found.');
$mails = $this
->getMails([
'id' => 'user_register_no_approval_required',
]);
$this
->assertEmpty($mails, 'No unblocked user email found.');
}