public function WishlistTest::testAdd in Commerce Wishlist 8.3
Tests adding a wishlist.
File
- tests/
src/ Functional/ WishlistTest.php, line 27
Class
- WishlistTest
- Tests the wishlist UI.
Namespace
Drupal\Tests\commerce_wishlist\FunctionalCode
public function testAdd() {
$this
->drupalGet(Url::fromRoute('entity.commerce_wishlist.collection')
->toString());
$this
->clickLink('Add wishlist');
$this
->submitForm([
'name[0][value]' => 'Special desire',
'is_public[value]' => '1',
'keep_purchased_items[value]' => '1',
], 'Save');
$this
->assertSession()
->pageTextContains('The wishlist Special desire has been successfully saved.');
$wishlist = Wishlist::load(1);
$this
->assertEquals('Special desire', $wishlist
->getName());
$this
->assertTrue($wishlist
->isPublic());
$this
->assertTrue($wishlist
->getKeepPurchasedItems());
$this
->assertEmpty($wishlist
->getItems());
$this
->assertNotEmpty($wishlist
->getCode());
}