Skip to content

Commit

Permalink
Create test-top-10.php
Browse files Browse the repository at this point in the history
  • Loading branch information
ajaydsouza committed Jan 12, 2025
1 parent bd32bfe commit 10d0b96
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions phpunit/tests/test-top-10.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/**
* Class TopTenTest
*
* @package Top_Ten
*/

/**
* Sample test case.
*/
class TopTenTest extends WP_UnitTestCase {

/**
* Test initialization of the plugin
*/
public function test_plugin_initialized() {
$this->assertTrue( class_exists( '\WebberZone\Top_Ten\Main' ) );
}

/**
* Create a test post and verify author
*/
public function test_create_post() {
$user_id = $this->factory->user->create();
$post_id = $this->factory->post->create(
array(
'post_author' => $user_id,
'post_status' => 'publish',
)
);

$post = get_post( $post_id );
$this->assertEquals( $user_id, $post->post_author );
}
}

0 comments on commit 10d0b96

Please sign in to comment.