PluginProbe
Orderable – Restaurant & Food Ordering System / 1.14.0
Orderable – Restaurant & Food Ordering System v1.14.0
0.1.4 0.1.5 0.2.0 1.0.0 1.1.0 1.1.1 1.10.0 1.10.1 1.11.0 1.12.0 1.12.1 1.12.2 1.13.0 1.14.0 1.15.0 1.16.0 1.17.0 1.17.1 1.18.0 1.19.0 1.19.1 1.19.2 1.2.0 1.20.0 1.20.1 All 44 releases
orderable / tests / php / unit / modules / services / test-services-order.php

test-services-order.php in Orderable – Restaurant & Food Ordering System 1.14.0, at tests/php/unit/modules/services/test-services-order.php

57 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Test Services Order module functionality
4 *
5 * @package Orderable/Tests
6 */
7
8 namespace OrderableTest;
9
10 use WP_UnitTestCase;
11
12 /**
13 * Checkout module test class
14 *
15 * Tests for inc/modules/class-services-order.php
16 */
17 class TestServiceOrders extends WP_UnitTestCase {
18 /**
19 * Test services_filter function
20 */
21 public function test_services_filter() {
22 ob_start();
23
24 \Orderable_Services_Order::services_filter();
25
26 $output = ob_get_clean();
27
28 $this->assertStringContainsString( 'name="orderable_service"', $output, 'The name of the field should be `orderable_service`' );
29
30 $this->assertStringContainsString( 'value=""', $output, 'An empty value attribute is required to show all services' );
31 $this->assertStringContainsString( 'All services', $output, '`All services` label is required' );
32
33 $this->assertStringContainsString( 'value="delivery"', $output, 'It should exist an option with value attribute set to `delivery`' );
34 $this->assertStringContainsString( 'Delivery', $output, 'It should exist an option with label set to `Delivery`' );
35
36 $this->assertStringContainsString( 'value="pickup"', $output, 'It should exist an option with value attribute set to `pickup`' );
37 $this->assertStringContainsString( 'Pickup', $output, 'It should exist an option with label set to `Pickup`' );
38
39 add_filter(
40 'orderable_services_filter_options',
41 function( $options ) {
42 $options[] = 'table';
43
44 return $options;
45 }
46 );
47
48 ob_start();
49
50 \Orderable_Services_Order::services_filter();
51
52 $output = ob_get_clean();
53
54 $this->assertStringContainsString( 'value="table"', $output, 'It should exist an option with a custom value added via `orderable_services_filter_options` filter' );
55 }
56 }
57