Skip to content

Commit

Permalink
chore: added unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GrigoreMihai committed Apr 10, 2024
1 parent a4b3549 commit 1342715
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/test-post-access.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,23 @@ public function test_custom_post_access() {

}

public function test_contributor_user_with_errors() {
$feedzy = new Feedzy_Rss_Feeds_Admin('feedzy', 'latest');
$contributor_id = $this->factory->user->create(
array(
'role' => 'contributor',
)
);
wp_set_current_user( $contributor_id );
$post_id = $this->factory->post->create( array( 'post_author' => get_current_user_id() ) );
$GLOBALS['post'] = get_post( $post_id );
// Mock feed object and errors.
$feed = (object) array( 'multifeed_url' => array( 'http://example.com/feed' ) );
$errors = array( 'Error 1', 'Error 2' );


$actual_output = $feedzy->feedzy_default_error_notice( $errors, $feed, 'http://example.com/feed' );

$this->assertEquals( '', $actual_output );
}
}

0 comments on commit 1342715

Please sign in to comment.