1
0
Fork 0
mirror of synced 2025-04-03 22:03:34 +03:00

fix tests

This commit is contained in:
Uryvskiy Dima 2023-12-05 17:31:02 +03:00
parent c88f74c87b
commit 2d579db3b5
3 changed files with 3 additions and 7 deletions

View file

@ -176,10 +176,9 @@ if (class_exists('WC_Retailcrm_Uploader') === false) {
$result = $wpdb->get_results("SELECT COUNT(ID) as `count` FROM $wpdb->posts WHERE post_type = 'shop_order'");
}
return $result[0]->count ?? 0;
return $result[0]->count ? (int) $result[0]->count : 0;
}
/**
* Return users ids
*
@ -197,7 +196,6 @@ if (class_exists('WC_Retailcrm_Uploader') === false) {
);
}
/**
* Return count users
*
@ -207,10 +205,9 @@ if (class_exists('WC_Retailcrm_Uploader') === false) {
{
$userCount = count_users();
return empty($userCount['total_users']) === false ? $userCount['total_users'] : 0;
return $userCount['total_users'] ? (int) $userCount['total_users'] : 0;
}
/**
* Array keys must be orders ID's in WooCommerce, values must be strings (error messages).
*

View file

@ -252,7 +252,7 @@ class WC_Retailcrm_Base_Test extends WC_Retailcrm_Test_Case_Helper
$this->baseRetailcrm->count_upload_data();
$uploadInfo = $this->getJsonData(ob_get_contents());
var_dump($uploadInfo);
$this->assertInternalType('array', $uploadInfo);
$this->assertArrayHasKey('count_orders', $uploadInfo);
$this->assertArrayHasKey('count_users', $uploadInfo);

View file

@ -109,7 +109,6 @@ class WC_Retailcrm_Uploader_Test extends WC_Retailcrm_Test_Case_Helper
{
$retailcrm_uploader = $this->getRetailcrmUploader($this->apiMock);
$count_orders = $retailcrm_uploader->getCountOrders();
var_dump($count_orders);
$this->assertInternalType('int', $count_orders);
}