You are here

public function OutOfStockTest::testOutOfStock in Commerce Stock 8

Test that the out of stock button is displayed.

File

modules/enforcement/tests/src/Functional/OutOfStockTest.php, line 42

Class

OutOfStockTest
Tests out of stock functionality.

Namespace

Drupal\Tests\commerce_stock_enforcement\Functional

Code

public function testOutOfStock() {
  $this->stockServiceManager
    ->createTransaction($this->variation, $this->locations[1]
    ->getId(), '', -10, 12.12, 'USD', StockTransactionsInterface::STOCK_IN, []);
  $this
    ->drupalGet('product/' . $this->product
    ->id());
  $this
    ->assertSession()
    ->buttonExists('Out of stock');
}