# orderable/1.14.0/tests/php/unit/modules/checkout/test-checkout.php

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

- Page: https://pluginprobe.com/plugins/orderable/1.14.0/code/tests/php/unit/modules/checkout/test-checkout.php
- Raw: https://pluginprobe.com/plugins/orderable/1.14.0/raw/tests/php/unit/modules/checkout/test-checkout.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/checkout/test-checkout.php#L10-L20`.

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

namespace OrderableTest;

use WP_UnitTestCase;

/**
 * Checkout module test class
 *
 * Tests for inc/modules/class-checkout.php
 */
class TestCheckout extends WP_UnitTestCase {

	/**
	 * Test is_order_date_valid function
	 */
	public function test_is_order_date_valid() {
		$this->assertTrue( \Orderable_Checkout::is_order_date_valid(), 'Empty order date should be a valid date.' );

		$_POST['orderable_order_date'] = 'asap';

		$this->assertTrue( \Orderable_Checkout::is_order_date_valid(), 'ASAP should be a valid date.' );

		$now = new \DateTime( 'now', wp_timezone() );

		$_POST['orderable_order_date'] = $now->getTimestamp();

		$this->assertTrue( \Orderable_Checkout::is_order_date_valid(), 'The current date should be a valid date.' );

		add_filter( 'doing_it_wrong_trigger_error', '__return_false' );

		$yesterday                     = new \DateTime( 'yesterday', wp_timezone() );
		$_POST['orderable_order_date'] = $yesterday->getTimestamp();

		$this->assertFalse( \Orderable_Checkout::is_order_date_valid(), 'The `yesterday` date should not be a valid date.' );
	}
}

```
