-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for
Plugins_Screens::remove_unused_filter_tabs()
. (#222)
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
tests/phpunit/tests/PluginsScreens/PluginsScreens_RemoveUnusedFilterTabsTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
/** | ||
* Class PluginsScreens_RemoveUnusedFilterTabsTest | ||
* | ||
* @package AspireUpdate | ||
*/ | ||
|
||
/** | ||
* Tests for Plugins_Screens::remove_unused_filter_tabs() | ||
* | ||
* @covers \AspireUpdate\Plugins_Screens::remove_unused_filter_tabs | ||
*/ | ||
class PluginsScreens_RemoveUnusedFilterTabsTest extends WP_UnitTestCase { | ||
/** | ||
* Test that unused filter tabs are removed. | ||
*/ | ||
public function test_should_remove_unused_filter_tabs() { | ||
$plugins_screens = new AspireUpdate\Plugins_Screens(); | ||
$reflected = new ReflectionProperty( | ||
$plugins_screens, | ||
'unsupported_filters' | ||
); | ||
$reflected->setAccessible( true ); | ||
$unsupported = $reflected->getValue( $plugins_screens ); | ||
$reflected->setAccessible( false ); | ||
|
||
$supported = [ | ||
'tab1' => true, | ||
'tab2' => true, | ||
'tab3' => true, | ||
]; | ||
|
||
$tabs = $supported; | ||
foreach ( $unsupported as $tab ) { | ||
$tabs[ $tab ] = true; | ||
} | ||
|
||
$this->assertSame( | ||
$supported, | ||
$plugins_screens->remove_unused_filter_tabs( $tabs ) | ||
); | ||
} | ||
} |