You are here

protected function CartIntegrationTest::setUp in Commerce Core 8.2

Overrides CartKernelTestBase::setUp

File

modules/log/tests/src/Kernel/CartIntegrationTest.php, line 58

Class

CartIntegrationTest
Tests integration with cart events.

Namespace

Drupal\Tests\commerce_log\Kernel

Code

protected function setUp() : void {
  parent::setUp();
  $this
    ->installEntitySchema('commerce_log');
  $this->user = $this
    ->createUser();
  $this->logStorage = $this->container
    ->get('entity_type.manager')
    ->getStorage('commerce_log');
  $this->logViewBuilder = $this->container
    ->get('entity_type.manager')
    ->getViewBuilder('commerce_log');

  // Turn off title generation to allow explicit values to be used.
  $variation_type = ProductVariationType::load('default');
  $variation_type
    ->setGenerateTitle(FALSE);
  $variation_type
    ->save();
  $this->variation = ProductVariation::create([
    'type' => 'default',
    'sku' => 'TEST_' . strtolower($this
      ->randomMachineName()),
    'title' => 'Testing product',
    'status' => 1,
    'price' => new Price('12.00', 'USD'),
  ]);
}