# orderable/1.14.0/tests/php/unit/modules/services/test-services-order.php

Orderable – Restaurant &amp; Food Ordering System, version 1.14.0. 57 lines.

- Page: https://pluginprobe.com/plugins/orderable/1.14.0/code/tests/php/unit/modules/services/test-services-order.php
- Raw: https://pluginprobe.com/plugins/orderable/1.14.0/raw/tests/php/unit/modules/services/test-services-order.php
- Modified: 2024-06-12T13:22:04+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/orderable/1.14.0/code/tests/php/unit/modules/services/test-services-order.php#L10-L20`.

```php
<?php
/**
 * Test Services Order module functionality
 *
 * @package Orderable/Tests
 */

namespace OrderableTest;

use WP_UnitTestCase;

/**
 * Checkout module test class
 *
 * Tests for inc/modules/class-services-order.php
 */
class TestServiceOrders extends WP_UnitTestCase {
	/**
	 * Test services_filter function
	 */
	public function test_services_filter() {
		ob_start();

		\Orderable_Services_Order::services_filter();

		$output = ob_get_clean();

		$this->assertStringContainsString( 'name="orderable_service"', $output, 'The name of the field should be `orderable_service`' );

		$this->assertStringContainsString( 'value=""', $output, 'An empty value attribute is required to show all services' );
		$this->assertStringContainsString( 'All services', $output, '`All services` label is required' );

		$this->assertStringContainsString( 'value="delivery"', $output, 'It should exist an option with value attribute set to `delivery`' );
		$this->assertStringContainsString( 'Delivery', $output, 'It should exist an option with label set to `Delivery`' );

		$this->assertStringContainsString( 'value="pickup"', $output, 'It should exist an option with value attribute set to `pickup`' );
		$this->assertStringContainsString( 'Pickup', $output, 'It should exist an option with label set to `Pickup`' );

		add_filter(
			'orderable_services_filter_options',
			function( $options ) {
				$options[] = 'table';

				return $options;
			}
		);

		ob_start();

		\Orderable_Services_Order::services_filter();

		$output = ob_get_clean();

		$this->assertStringContainsString( 'value="table"', $output, 'It should exist an option with a custom value added via `orderable_services_filter_options` filter' );
	}
}

```
