public function OrderEmailTest::testOrderEmail in Commerce Core 8.2
Covers evaluate.
File
- modules/
order/ tests/ src/ Unit/ Plugin/ Commerce/ Condition/ OrderEmailTest.php, line 18
Class
- OrderEmailTest
- @coversDefaultClass \Drupal\commerce_order\Plugin\Commerce\Condition\OrderEmail @group commerce
Namespace
Drupal\Tests\commerce_order\Unit\Plugin\Commerce\ConditionCode
public function testOrderEmail() {
$condition = new OrderEmail([
'mail' => 'tests@test.com',
], 'order_mail', [
'entity_type' => 'commerce_order',
]);
$order1 = $this
->prophesize(OrderInterface::class);
$order1
->getEntityTypeId()
->willReturn('commerce_order');
$order1
->getEmail()
->willReturn(NULL);
$order1 = $order1
->reveal();
$order2 = $this
->prophesize(OrderInterface::class);
$order2
->getEntityTypeId()
->willReturn('commerce_order');
$order2
->getEmail()
->willReturn('tests@test.com');
$order2 = $order2
->reveal();
$this
->assertFalse($condition
->evaluate($order1));
$this
->assertTrue($condition
->evaluate($order2));
}