Skip to content

Commit

Permalink
modify tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vancoder committed Oct 25, 2023
1 parent f0c22c0 commit 254968c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/alley/wp/alleyvate/features/test-clean-admin-bar.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function test_remove_admin_bar_nodes() {
$disposable_nodes = $this->feature->get_disposable_nodes();
$current_nodes = $admin_bar->get_nodes();

// Let's make sure they are there before we remove them.
// Let's make sure the nodes exist before we remove them.
foreach ( $disposable_nodes as $disposable_node ) {
// Updates will not exist in a test context.
if ( 'updates' === $disposable_node ) {
Expand Down Expand Up @@ -77,7 +77,7 @@ public function test_remove_admin_bar_nodes() {
public function test_filter() {

$admin_bar = $this->apply_admin_bar();
$node = 'comments';
$node = 'my-account';

add_filter(
'alleyvate_clean_admin_bar_menus',
Expand All @@ -88,6 +88,12 @@ function ( $disposable_nodes ) use ( $node ) {
}
);

// Get nodes to compare.
$current_nodes = $admin_bar->get_nodes();

// Let's make sure the node exists before we remove it.
$this->assertArrayHasKey( $node, $current_nodes, 'The filtered node ' . $node . ' should exist in $wp_admin_bar global prior to boot.' );

// Boot feature.
$this->feature->boot();
do_action( 'wp_before_admin_bar_render' ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
Expand Down

0 comments on commit 254968c

Please sign in to comment.