Generate icml test
This commit is contained in:
parent
dd7b4df5da
commit
f09d4c1f72
@ -13,6 +13,7 @@
|
||||
"require-dev": {
|
||||
"ext-json": "*",
|
||||
"ext-mbstring": "*",
|
||||
"ext-simplexml": "*",
|
||||
"phpunit/phpunit": "6.*"
|
||||
}
|
||||
}
|
||||
|
@ -413,7 +413,9 @@ if ( ! class_exists( 'WC_Retailcrm_Icml' ) ) :
|
||||
'name' => $term->name
|
||||
);
|
||||
|
||||
$thumbnail_id = get_woocommerce_term_meta($term->term_id, 'thumbnail_id', true);
|
||||
$thumbnail_id = function_exists('get_term_meta')
|
||||
? get_term_meta($term->term_id, 'thumbnail_id', true)
|
||||
: get_woocommerce_term_meta($term->term_id, 'thumbnail_id', true);
|
||||
$picture = wp_get_attachment_url($thumbnail_id);
|
||||
|
||||
if ($picture) {
|
||||
|
@ -17,6 +17,7 @@ function _manually_load_plugin() {
|
||||
require $plugin_dir . 'src/include/class-wc-retailcrm-ga.php';
|
||||
require $plugin_dir . 'src/include/class-wc-retailcrm-daemon-collector.php';
|
||||
require $plugin_dir . 'src/include/class-wc-retailcrm-history.php';
|
||||
require $plugin_dir . 'src/include/class-wc-retailcrm-icml.php';
|
||||
require $plugin_dir . 'src/retailcrm.php';
|
||||
}
|
||||
|
||||
|
29
tests/test-wc-retailcrm-icml.php
Normal file
29
tests/test-wc-retailcrm-icml.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
class WC_Retailcrm_Icml_Test extends WC_Retailcrm_Test_Case_Helper
|
||||
{
|
||||
public function setUp()
|
||||
{
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
WC_Helper_Product::create_simple_product();
|
||||
}
|
||||
|
||||
WC_Helper_Product::create_variation_product();
|
||||
}
|
||||
|
||||
public function testGenerate()
|
||||
{
|
||||
$icml = new WC_Retailcrm_Icml();
|
||||
$icml->generate();
|
||||
|
||||
$this->assertFileExists(ABSPATH . 'retailcrm.xml');
|
||||
$xml = simplexml_load_file(ABSPATH . 'retailcrm.xml');
|
||||
$res = $xml->xpath('/yml_catalog/shop/categories/category[@id]');
|
||||
|
||||
$this->assertNotEmpty($res);
|
||||
|
||||
foreach ($res as $node) {
|
||||
$this->assertEquals('category', $node->getName());
|
||||
}
|
||||
}
|
||||
}
|
@ -42,6 +42,19 @@ class WC_Retailcrm_Plugin_Test extends WC_Retailcrm_Test_Case_Helper
|
||||
}
|
||||
}
|
||||
|
||||
public function test_filter_cron_schedules()
|
||||
{
|
||||
$plugin = WC_Retailcrm_Plugin::getInstance(dirname(__DIR__ . '/../src/retailcrm.php'));
|
||||
$schedules = $plugin->filter_cron_schedules(array());
|
||||
|
||||
$this->assertNotEmpty($schedules['five_minutes']);
|
||||
$this->assertEquals(300, $schedules['five_minutes']['interval']);
|
||||
$this->assertNotEmpty($schedules['three_hours']);
|
||||
$this->assertEquals(10800, $schedules['three_hours']['interval']);
|
||||
$this->assertNotEmpty($schedules['fiveteen_minutes']);
|
||||
$this->assertEquals(900, $schedules['fiveteen_minutes']['interval']);
|
||||
}
|
||||
|
||||
private function getResponseData()
|
||||
{
|
||||
return array(
|
||||
|
Loading…
x
Reference in New Issue
Block a user