You are here

public function OrderIntegrationTest::testCliMode in Commerce Currency Resolver 8

Tests the refresh of orders loading in CLI mode.

@covers ::checkCurrency @covers ::shouldCurrencyRefresh

File

tests/src/Kernel/OrderIntegrationTest.php, line 117

Class

OrderIntegrationTest
Tests integration with orders.

Namespace

Drupal\Tests\commerce_currency_resolver\Kernel

Code

public function testCliMode() {
  $order_item = OrderItem::create([
    'type' => 'test',
    'quantity' => '1',
    'unit_price' => new Price('12.00', 'HRK'),
  ]);
  $order_item
    ->save();
  $this->order
    ->addItem($order_item);
  $this->order
    ->save();
  $order = Order::load(1);
  $this
    ->assertInstanceOf(OrderInterface::class, $order);
  $this
    ->assertEqual('cli', PHP_SAPI);
  $this
    ->assertEqual('HRK', $this->order
    ->getTotalPrice()
    ->getCurrencyCode());
  $this
    ->assertEqual('USD', $this->currentCurrency
    ->getCurrency());
}