mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-28 13:00:19 +00:00
Tests: Introduce assertSameSets() and assertSameSetsWithIndex(), and use them where appropriate.
This ensures that not only the array values being compared are equal, but also that their type is the same. These new methods replace most of the existing instances of `assertEqualSets()` and `assertEqualSetsWithIndex()`. Going forward, stricter type checking by using `assertSameSets()` or `assertSameSetsWithIndex()` should generally be preferred, to make the tests more reliable. Follow-up to [48937]. See #38266. git-svn-id: https://develop.svn.wordpress.org/trunk@48939 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -48,7 +48,7 @@ class Tests_Admin_includesTheme extends WP_UnitTestCase {
|
||||
|
||||
switch_theme( $theme['Template'], $theme['Stylesheet'] );
|
||||
|
||||
$this->assertEqualSetsWithIndex(
|
||||
$this->assertSameSetsWithIndex(
|
||||
array(
|
||||
'Top Level' => 'template-top-level.php',
|
||||
'Sub Dir' => 'subdir/template-sub-dir.php',
|
||||
@@ -62,7 +62,7 @@ class Tests_Admin_includesTheme extends WP_UnitTestCase {
|
||||
|
||||
switch_theme( $theme['Template'], $theme['Stylesheet'] );
|
||||
|
||||
$this->assertEqualSetsWithIndex(
|
||||
$this->assertSameSetsWithIndex(
|
||||
array(
|
||||
'Top Level' => 'template-top-level.php',
|
||||
'Sub Dir' => 'subdir/template-sub-dir.php',
|
||||
@@ -81,14 +81,14 @@ class Tests_Admin_includesTheme extends WP_UnitTestCase {
|
||||
|
||||
switch_theme( $theme['Template'], $theme['Stylesheet'] );
|
||||
|
||||
$this->assertEqualSetsWithIndex(
|
||||
$this->assertSameSetsWithIndex(
|
||||
array(
|
||||
'Top Level' => 'template-top-level-post-types.php',
|
||||
'Sub Dir' => 'subdir/template-sub-dir-post-types.php',
|
||||
),
|
||||
get_page_templates( null, 'foo' )
|
||||
);
|
||||
$this->assertEqualSetsWithIndex(
|
||||
$this->assertSameSetsWithIndex(
|
||||
array(
|
||||
'Top Level' => 'template-top-level-post-types.php',
|
||||
'Sub Dir' => 'subdir/template-sub-dir-post-types.php',
|
||||
@@ -107,7 +107,7 @@ class Tests_Admin_includesTheme extends WP_UnitTestCase {
|
||||
|
||||
switch_theme( $theme['Template'], $theme['Stylesheet'] );
|
||||
|
||||
$this->assertEqualSetsWithIndex(
|
||||
$this->assertSameSetsWithIndex(
|
||||
array(
|
||||
'No Trailing Period' => '38766/no-trailing-period-post-types.php',
|
||||
'Trailing Period.' => '38766/trailing-period-post-types.php',
|
||||
@@ -118,7 +118,7 @@ class Tests_Admin_includesTheme extends WP_UnitTestCase {
|
||||
),
|
||||
get_page_templates( null, 'period' )
|
||||
);
|
||||
$this->assertEqualSetsWithIndex(
|
||||
$this->assertSameSetsWithIndex(
|
||||
array(
|
||||
'No Trailing Period' => '38766/no-trailing-period-post-types.php',
|
||||
'Trailing Period.' => '38766/trailing-period-post-types.php',
|
||||
@@ -139,7 +139,7 @@ class Tests_Admin_includesTheme extends WP_UnitTestCase {
|
||||
|
||||
switch_theme( $theme['Template'], $theme['Stylesheet'] );
|
||||
|
||||
$this->assertEqualSetsWithIndex(
|
||||
$this->assertSameSetsWithIndex(
|
||||
array(
|
||||
'Top Level' => 'template-top-level-post-types.php',
|
||||
'Sub Dir' => 'subdir/template-sub-dir-post-types.php',
|
||||
@@ -149,7 +149,7 @@ class Tests_Admin_includesTheme extends WP_UnitTestCase {
|
||||
get_page_templates( null, 'foo' )
|
||||
);
|
||||
|
||||
$this->assertEqualSetsWithIndex(
|
||||
$this->assertSameSetsWithIndex(
|
||||
array(
|
||||
'Top Level' => 'template-top-level-post-types.php',
|
||||
'Sub Dir' => 'subdir/template-sub-dir-post-types.php',
|
||||
@@ -157,7 +157,7 @@ class Tests_Admin_includesTheme extends WP_UnitTestCase {
|
||||
get_page_templates( null, 'post' )
|
||||
);
|
||||
|
||||
$this->assertEqualSetsWithIndex(
|
||||
$this->assertSameSetsWithIndex(
|
||||
array(
|
||||
'Top Level' => 'template-top-level.php',
|
||||
'Sub Dir' => 'subdir/template-sub-dir.php',
|
||||
@@ -180,7 +180,7 @@ class Tests_Admin_includesTheme extends WP_UnitTestCase {
|
||||
|
||||
$post_templates = $theme->get_post_templates();
|
||||
|
||||
$this->assertEqualSetsWithIndex(
|
||||
$this->assertSameSetsWithIndex(
|
||||
array(
|
||||
'template-top-level-post-types.php' => 'Top Level',
|
||||
'subdir/template-sub-dir-post-types.php' => 'Sub Dir',
|
||||
@@ -190,7 +190,7 @@ class Tests_Admin_includesTheme extends WP_UnitTestCase {
|
||||
$post_templates['foo']
|
||||
);
|
||||
|
||||
$this->assertEqualSetsWithIndex(
|
||||
$this->assertSameSetsWithIndex(
|
||||
array(
|
||||
'template-top-level-post-types.php' => 'Top Level',
|
||||
'subdir/template-sub-dir-post-types.php' => 'Sub Dir',
|
||||
@@ -198,7 +198,7 @@ class Tests_Admin_includesTheme extends WP_UnitTestCase {
|
||||
$post_templates['post']
|
||||
);
|
||||
|
||||
$this->assertEqualSetsWithIndex(
|
||||
$this->assertSameSetsWithIndex(
|
||||
array(
|
||||
'template-top-level.php' => 'Top Level',
|
||||
'subdir/template-sub-dir.php' => 'Sub Dir',
|
||||
|
||||
Reference in New Issue
Block a user