You are here

public function StockLevelTest::testStockLevelStockOut in Commerce Stock 8

Whether setting a plain negative results in reduced stock level.

Throws

\Drupal\Core\Entity\EntityStorageException

File

modules/field/tests/src/Kernel/StockLevelTest.php, line 181

Class

StockLevelTest
Ensure the stock level field works.

Namespace

Drupal\Tests\commerce_stock_field\Kernel

Code

public function testStockLevelStockOut() {
  $this->variation
    ->set('test_stock_level', -10);
  $this->variation
    ->save();
  $this
    ->assertEquals(45, $this->checker
    ->getTotalStockLevel($this->variation, $this->locations));
}