2020-04-28 21:47:05 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Onboarding Themes Tests.
|
|
|
|
*
|
2020-08-11 19:18:47 +00:00
|
|
|
* @package WooCommerce\Admin\Tests\OnboardingThemes
|
2020-04-28 21:47:05 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
use \Automattic\WooCommerce\Admin\Features\Onboarding;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class WC_Tests_Onboarding
|
|
|
|
*/
|
|
|
|
class WC_Tests_Onboarding extends WC_Unit_Test_Case {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Verifies that given an array of theme objects, the object containing Storefront will be sorted to the first position.
|
|
|
|
*/
|
|
|
|
public function test_sort_woocommerce_themes() {
|
|
|
|
$theme1 = (object) array(
|
|
|
|
'id' => 1,
|
|
|
|
'slug' => 'ribs',
|
|
|
|
);
|
|
|
|
$theme2 = (object) array(
|
|
|
|
'id' => 2,
|
|
|
|
'slug' => 'chicken',
|
|
|
|
);
|
|
|
|
$theme3 = (object) array(
|
|
|
|
'id' => 3,
|
|
|
|
'slug' => 'Storefront',
|
|
|
|
);
|
|
|
|
$theme4 = (object) array(
|
|
|
|
'id' => 4,
|
|
|
|
'slug' => 'poutine',
|
|
|
|
);
|
|
|
|
$some_themes = array( $theme1, $theme2, $theme3, $theme4 );
|
|
|
|
$sorted_themes = \Automattic\WooCommerce\Admin\Features\Onboarding::sort_woocommerce_themes( $some_themes );
|
|
|
|
$this->assertEquals( 'Storefront', $sorted_themes[0]->slug );
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|