public function PriceListRepositoryTest::testStores in Commerce Pricelist 8.2
Tests stores-based loading.
@covers ::loadItem @covers ::loadItems
File
- tests/
src/ Kernel/ PriceListRepositoryTest.php, line 109
Class
- PriceListRepositoryTest
- Tests the price list repository.
Namespace
Drupal\Tests\commerce_pricelist\KernelCode
public function testStores() {
$context = new Context($this->user, $this->store);
$repository = $this->container
->get('commerce_pricelist.repository');
$new_store = $this
->createStore();
$this->priceList
->setStores([
$new_store,
]);
$this->priceList
->save();
$price_list_item = $repository
->loadItem($this->variation, 1, $context);
$this
->assertEmpty($price_list_item);
$context = new Context($this->user, $new_store);
$price_list_item = $repository
->loadItem($this->variation, 1, $context);
$this
->assertEquals(new Price('5.00', 'USD'), $price_list_item
->getPrice());
}