You are here

public function OrderPaymentGatewayTest::testIncompleteOrder in Commerce Core 8.2

::covers evaluate.

File

modules/payment/tests/src/Unit/Plugin/Commerce/Condition/OrderPaymentGatewayTest.php, line 20

Class

OrderPaymentGatewayTest
@coversDefaultClass \Drupal\commerce_payment\Plugin\Commerce\Condition\OrderPaymentGateway @group commerce

Namespace

Drupal\Tests\commerce_payment\Unit\Plugin\Commerce\Condition

Code

public function testIncompleteOrder() {
  $condition = new OrderPaymentGateway([
    'payment_gateways' => [
      'test',
    ],
  ], 'order_payment_gateway', [
    'entity_type' => 'commerce_order',
  ]);
  $order = $this
    ->prophesize(OrderInterface::class);
  $entity_reference_item = $this
    ->prophesize(EntityReferenceItem::class);
  $entity_reference_item
    ->isEmpty()
    ->willReturn(TRUE);
  $entity_reference_item = $entity_reference_item
    ->reveal();
  $order = $this
    ->prophesize(OrderInterface::class);
  $order
    ->getEntityTypeId()
    ->willReturn('commerce_order');
  $order
    ->get('payment_gateway')
    ->willReturn($entity_reference_item);
  $order = $order
    ->reveal();
  $this
    ->assertFalse($condition
    ->evaluate($order));
}