public function WishlistItemTest::testAdd in Commerce Wishlist 8.3
Tests adding a wishlist item.
File
- tests/
src/ Functional/ WishlistItemTest.php, line 90
Class
- WishlistItemTest
- Tests the wishlist item UI.
Namespace
Drupal\Tests\commerce_wishlist\FunctionalCode
public function testAdd() {
$this
->drupalGet($this->wishListItemCollectionUri);
$this
->clickLink('Add item');
$this
->submitForm([
'purchasable_entity[0][target_id]' => 'Standing desk (1)',
'quantity[0][value]' => '1',
'comment[0][value]' => 'Love this desk',
], 'Save');
$this
->assertSession()
->pageTextContains('The item Standing desk has been successfully saved.');
$wishlist_item = WishlistItem::load(1);
$this
->assertEquals($this->wishList
->id(), $wishlist_item
->getWishListId());
$this
->assertEquals($this->firstVariation
->id(), $wishlist_item
->getPurchasableEntityId());
$this
->assertEquals('1', $wishlist_item
->getQuantity());
$this
->assertNotEmpty($wishlist_item
->getComment());
}