public function PurchasableEntityTypeRepositoryTest::testGetPurchasableEntityTypeLabels in Commerce Core 8.2
@covers ::getPurchasableEntityTypeLabels
File
- tests/
src/ Unit/ PurchasableEntityTypeRepositoryTest.php, line 77
Class
- PurchasableEntityTypeRepositoryTest
- @coversDefaultClass \Drupal\commerce\PurchasableEntityTypeRepository @group commerce
Namespace
Drupal\Tests\commerce\UnitCode
public function testGetPurchasableEntityTypeLabels() {
$etm = $this
->prophesize(EntityTypeManagerInterface::class);
$etm
->getDefinitions()
->willReturn($this
->createMockedDefinitions([
'node' => [
'is_purchasable' => FALSE,
'label' => 'Node',
],
'commerce_product' => [
'is_purchasable' => FALSE,
'label' => 'Product',
],
'commerce_product_variation' => [
'is_purchasable' => TRUE,
'label' => 'Product variation',
],
'widget' => [
'is_purchasable' => TRUE,
'label' => 'Widget',
],
]));
$sut = new PurchasableEntityTypeRepository($etm
->reveal());
$this
->assertEquals([
'commerce_product_variation' => 'Product variation',
'widget' => 'Widget',
], $sut
->getPurchasableEntityTypeLabels());
}