From d644d02238c29314afceb5a0b8c8edb19db9bb71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B0=D0=B2=D0=B5=D0=BB?= Date: Mon, 8 Jun 2020 11:46:21 +0300 Subject: [PATCH] different check for a customer in the order --- tests/bootstrap.php | 17 ----------------- tests/test-wc-retailcrm-history.php | 7 ++++++- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 50207bc..1aca407 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -40,20 +40,3 @@ require $plugin_dir . 'tests/helpers/class-wc-retailcrm-test-case-helper.php'; require $plugin_dir . 'tests/helpers/class-wc-retailcrm-log-handler-stdout.php'; WC_Retailcrm_Logger::setAdditionalHandlers(array(new WC_Retailcrm_Log_Handler_Stdout())); - -/** - * Returns true if WP version is 4.6 or older. It's useful in some tests. - * - * @return bool - */ -function is_wp_older_or_4_6() { - include(ABSPATH . WPINC . '/version.php'); - - if (!empty($wp_version)) { - $version = explode('.', substr($wp_version, 0, 3)); - - return count($version) == 2 && ($version[0] > 4 || $version[1] > 6); - } - - return true; -} diff --git a/tests/test-wc-retailcrm-history.php b/tests/test-wc-retailcrm-history.php index 3ad9625..602a99c 100644 --- a/tests/test-wc-retailcrm-history.php +++ b/tests/test-wc-retailcrm-history.php @@ -297,7 +297,12 @@ class WC_Retailcrm_History_Test extends WC_Retailcrm_Test_Case_Helper $this->assertEquals('Компания1', $order->get_billing_company()); $this->assertEquals('9135487458709', $order->get_billing_phone()); - if (!is_wp_older_or_4_6()) { + $orderUser = $order->get_user(); + + if ($orderUser instanceof WP_User) { + $this->assertEquals('psycho913', $orderUser->get('_billing_first_name')); + $this->assertEquals('psycho913', $orderUser->get('_billing_last_name')); + } else { $this->assertEmpty($order->get_customer_id()); } }