public function PriceResolverTest::testResolver in Commerce Pricelist 8.2
Tests the that the correct price list is resolved based on the context.
File
- tests/
src/ Kernel/ PriceResolverTest.php, line 79
Class
- PriceResolverTest
- Tests the price list resolver.
Namespace
Drupal\Tests\commerce_pricelist\KernelCode
public function testResolver() {
$resolver = $this->container
->get('commerce_pricelist.price_resolver');
$context = new Context($this->user, $this->store);
$resolved_price = $resolver
->resolve($this->variation, 1, $context);
$this
->assertEquals(new Price('5.00', 'USD'), $resolved_price);
$context = new Context($this->user, $this->store, NULL, [
'field_name' => 'list_price',
]);
$resolved_price = $resolver
->resolve($this->variation, 1, $context);
$this
->assertEquals(new Price('7.70', 'USD'), $resolved_price);
}