Skip to content

Commit

Permalink
Add tests for Plugins_Screens::remove_unused_filter_tabs(). (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
costdev authored Dec 1, 2024
1 parent 3680c0a commit 5d4dfcd
Showing 1 changed file with 43 additions and 0 deletions.
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 )
);
}
}

0 comments on commit 5d4dfcd

Please sign in to comment.