From e89bef3d52a49b8564942b583c2f4d74188f91fd Mon Sep 17 00:00:00 2001 From: claudiulodro Date: Tue, 8 Aug 2017 10:31:06 -0700 Subject: [PATCH] Update tests to handle related plugins --- tests/unit-tests/util/plugin-updates.php | 32 ++++++++++++++++++------ 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/tests/unit-tests/util/plugin-updates.php b/tests/unit-tests/util/plugin-updates.php index 6d9e3364730..65118e58e71 100644 --- a/tests/unit-tests/util/plugin-updates.php +++ b/tests/unit-tests/util/plugin-updates.php @@ -75,16 +75,32 @@ class WC_Tests_Plugin_Updates extends WC_Unit_Test_Case { ), ); $new_version = '4.0.0'; - $this->assertEquals( array(), $this->updates->get_untested_plugins( $new_version, $release, false ) ); + $untested = $this->updates->get_untested_plugins( $new_version, $release ); + $this->assertArrayNotHasKey( 'test/test.php', $untested ); + $this->assertArrayNotHasKey( 'test2/test2.php', $untested ); + $this->assertArrayNotHasKey( 'test3/test3.php', $untested ); + $this->assertArrayNotHasKey( 'test4/test4.php', $untested ); $new_version = '3.9.0'; - $this->assertEquals( array(), $this->updates->get_untested_plugins( $new_version, $release, false ) ); + $untested = $this->updates->get_untested_plugins( $new_version, $release ); + $this->assertArrayNotHasKey( 'test/test.php', $untested ); + $this->assertArrayNotHasKey( 'test2/test2.php', $untested ); + $this->assertArrayNotHasKey( 'test3/test3.php', $untested ); + $this->assertArrayNotHasKey( 'test4/test4.php', $untested ); $new_version = '4.3.0'; - $this->assertEquals( array(), $this->updates->get_untested_plugins( $new_version, $release, false ) ); + $untested = $this->updates->get_untested_plugins( $new_version, $release ); + $this->assertArrayNotHasKey( 'test/test.php', $untested ); + $this->assertArrayNotHasKey( 'test2/test2.php', $untested ); + $this->assertArrayNotHasKey( 'test3/test3.php', $untested ); + $this->assertArrayNotHasKey( 'test4/test4.php', $untested ); $new_version = '4.0.2'; - $this->assertEquals( array(), $this->updates->get_untested_plugins( $new_version, $release ) ); + $untested = $this->updates->get_untested_plugins( $new_version, $release ); + $this->assertArrayNotHasKey( 'test/test.php', $untested ); + $this->assertArrayNotHasKey( 'test2/test2.php', $untested ); + $this->assertArrayNotHasKey( 'test3/test3.php', $untested ); + $this->assertArrayNotHasKey( 'test4/test4.php', $untested ); } /** @@ -110,13 +126,13 @@ class WC_Tests_Plugin_Updates extends WC_Unit_Test_Case { ), ); $new_version = '4.0.0'; - $this->assertEquals( $this->plugins, $this->updates->get_untested_plugins( $new_version, $release ) ); + $this->assertArraySubset( $this->plugins, $this->updates->get_untested_plugins( $new_version, $release ) ); $new_version = '4.3.0'; - $this->assertEquals( $this->plugins, $this->updates->get_untested_plugins( $new_version, $release ) ); + $this->assertArraySubset( $this->plugins, $this->updates->get_untested_plugins( $new_version, $release ) ); $new_version = '4.0.2'; - $this->assertEquals( $this->plugins, $this->updates->get_untested_plugins( $new_version, $release ) ); + $this->assertArraySubset( $this->plugins, $this->updates->get_untested_plugins( $new_version, $release ) ); } /** @@ -220,7 +236,7 @@ class WC_Tests_Plugin_Updates extends WC_Unit_Test_Case { $release = 'major'; $new_version = '5.0.0'; - $this->assertEquals( array( 'test/test.php' => $this->plugins['test/test.php'] ), $this->updates->get_untested_plugins( $new_version, $release ) ); + $this->assertArraySubset( array( 'test/test.php' => $this->plugins['test/test.php'] ), $this->updates->get_untested_plugins( $new_version, $release ) ); $release = 'minor'; $new_version = '4.1.0';