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 / checkout / test-checkout.php

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

43 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Test Checkout 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-checkout.php
16 */
17 class TestCheckout extends WP_UnitTestCase {
18
19 /**
20 * Test is_order_date_valid function
21 */
22 public function test_is_order_date_valid() {
23 $this->assertTrue( \Orderable_Checkout::is_order_date_valid(), 'Empty order date should be a valid date.' );
24
25 $_POST['orderable_order_date'] = 'asap';
26
27 $this->assertTrue( \Orderable_Checkout::is_order_date_valid(), 'ASAP should be a valid date.' );
28
29 $now = new \DateTime( 'now', wp_timezone() );
30
31 $_POST['orderable_order_date'] = $now->getTimestamp();
32
33 $this->assertTrue( \Orderable_Checkout::is_order_date_valid(), 'The current date should be a valid date.' );
34
35 add_filter( 'doing_it_wrong_trigger_error', '__return_false' );
36
37 $yesterday = new \DateTime( 'yesterday', wp_timezone() );
38 $_POST['orderable_order_date'] = $yesterday->getTimestamp();
39
40 $this->assertFalse( \Orderable_Checkout::is_order_date_valid(), 'The `yesterday` date should not be a valid date.' );
41 }
42 }
43