You are here

public function MonitoringCommerceTest::testOrderStatusSensors in Monitoring 7

Test commerce order count sensors with different order status.

File

test/tests/monitoring.commerce.test, line 93
Contains \MonitoringCommerceTest.

Class

MonitoringCommerceTest
Tests for commerce order turnover sensor.

Code

public function testOrderStatusSensors() {
  $this
    ->createEmptyOrderWithPrice('pending');
  $this
    ->createEmptyOrderWithPrice('pending');
  $this
    ->createEmptyOrderWithPrice('completed');
  $result = $this
    ->runSensor('commerce_order_status_pending');
  $this
    ->assertEqual($result
    ->getValue(), 2);
  $this
    ->assertEqual($result
    ->getMessage(), '2 orders in 1 day');
  $result = $this
    ->runSensor('commerce_order_status_completed');
  $this
    ->assertEqual($result
    ->getValue(), 1);
  $this
    ->assertEqual($result
    ->getMessage(), '1 orders in 1 day');
}