2020-04-28 21:47:05 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Onboarding Themes Tests.
|
|
|
|
*
|
2022-03-17 20:10:43 +00:00
|
|
|
* @package WooCommerce\Internal\Admin\Tests\OnboardingThemes
|
2020-04-28 21:47:05 +00:00
|
|
|
*/
|
|
|
|
|
2022-03-17 20:10:43 +00:00
|
|
|
use \Automattic\WooCommerce\Internal\Admin\Onboarding\OnboardingThemes;
|
2020-04-28 21:47:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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 );
|
2022-03-17 20:10:43 +00:00
|
|
|
$sorted_themes = OnboardingThemes::sort_woocommerce_themes( $some_themes );
|
2020-04-28 21:47:05 +00:00
|
|
|
$this->assertEquals( 'Storefront', $sorted_themes[0]->slug );
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|