public function StockLocationStorageTest::testLoadEnabled in Commerce Stock 8
Tests loadEnabled() function.
File
- modules/
local_storage/ tests/ src/ Kernel/ StockLocationStorageTest.php, line 49
Class
- StockLocationStorageTest
- Test the stock location storage.
Namespace
Drupal\Tests\commerce_stock_local\KernelCode
public function testLoadEnabled() {
for ($i = 1; $i <= 3; $i++) {
$location = StockLocation::create([
'type' => 'default',
'name' => $this
->randomString(),
'status' => $i % 2,
]);
$location
->save();
}
$dummyPurchasable = $this
->prophesize('Drupal\\commerce\\PurchasableEntityInterface');
$enabledLocations = $this->locationStorage
->loadEnabled($dummyPurchasable
->reveal());
$this
->assertEquals(2, count($enabledLocations), '2 out of 3 locations are enabled');
}