Add code coverage report

This commit is contained in:
Ian Dunn 2022-09-13 11:34:51 -07:00
parent 0964167f12
commit 0e88966246
No known key found for this signature in database
GPG key ID: 99B971B50343CBCB
8 changed files with 111 additions and 367 deletions

View file

@ -80,7 +80,7 @@ class Test_Auth extends WP_UnitTestCase {
}
/**
* @covers ::is_valid_authentication_token
* @covers WordPressDotOrg\FiveForTheFuture\Auth\is_valid_authentication_token
*/
public function test_valid_token_accepted() {
$verified = is_valid_authentication_token( self::$pledge->ID, self::$action, self::$token['value'] );
@ -88,7 +88,7 @@ class Test_Auth extends WP_UnitTestCase {
}
/**
* @covers ::is_valid_authentication_token
* @covers WordPressDotOrg\FiveForTheFuture\Auth\is_valid_authentication_token
* @dataProvider data_invalid_token_provider
*/
public function test_invalid_tokens_are_rejected( $token_to_validate ) {
@ -107,7 +107,7 @@ class Test_Auth extends WP_UnitTestCase {
* Note that data providers can't access fixtures.
* See https://phpunit.readthedocs.io/en/7.4/writing-tests-for-phpunit.html#data-providers.
*
* @covers ::is_valid_authentication_token
* @covers WordPressDotOrg\FiveForTheFuture\Auth\is_valid_authentication_token
*/
public function data_invalid_token_provider() {
return array(
@ -119,7 +119,7 @@ class Test_Auth extends WP_UnitTestCase {
}
/**
* @covers ::is_valid_authentication_token
* @covers WordPressDotOrg\FiveForTheFuture\Auth\is_valid_authentication_token
*/
public function test_expired_tokens_are_rejected() {
$expired_token = self::$token;
@ -137,7 +137,7 @@ class Test_Auth extends WP_UnitTestCase {
}
/**
* @covers ::is_valid_authentication_token
* @covers WordPressDotOrg\FiveForTheFuture\Auth\is_valid_authentication_token
*/
public function test_used_tokens_are_rejected() {
// The token should be deleted once it's used/verified for the first time.
@ -149,7 +149,7 @@ class Test_Auth extends WP_UnitTestCase {
}
/**
* @covers ::is_valid_authentication_token
* @covers WordPressDotOrg\FiveForTheFuture\Auth\is_valid_authentication_token
*/
public function test_valid_tokens_are_rejected_for_other_actions() {
// Generate new token on pledge.
@ -167,7 +167,7 @@ class Test_Auth extends WP_UnitTestCase {
}
/**
* @covers ::is_valid_authentication_token
* @covers WordPressDotOrg\FiveForTheFuture\Auth\is_valid_authentication_token
*/
public function test_valid_tokens_are_rejected_for_other_pledges() {
$new_pledge_id = self::factory()->post->create( array(
@ -190,7 +190,7 @@ class Test_Auth extends WP_UnitTestCase {
}
/**
* @covers ::is_valid_authentication_token
* @covers WordPressDotOrg\FiveForTheFuture\Auth\is_valid_authentication_token
*/
public function test_reusable_token_is_reusable() {
$action = 'manage_pledge';
@ -207,7 +207,7 @@ class Test_Auth extends WP_UnitTestCase {
}
/**
* @covers ::is_valid_authentication_token
* @covers WordPressDotOrg\FiveForTheFuture\Auth\is_valid_authentication_token
*/
public function test_expired_reusable_tokens_are_rejected() {
$action = 'manage_pledge';
@ -222,7 +222,7 @@ class Test_Auth extends WP_UnitTestCase {
}
/**
* @covers ::can_manage_pledge
* @covers WordPressDotOrg\FiveForTheFuture\Auth\can_manage_pledge
*/
public function test_user_with_token_can_manage_pledge() {
$action = 'manage_pledge';
@ -233,7 +233,7 @@ class Test_Auth extends WP_UnitTestCase {
}
/**
* @covers ::can_manage_pledge
* @covers WordPressDotOrg\FiveForTheFuture\Auth\can_manage_pledge
*/
public function test_user_without_token_cant_manage_pledge() {
$result = can_manage_pledge( self::$pledge->ID, '' );
@ -241,7 +241,7 @@ class Test_Auth extends WP_UnitTestCase {
}
/**
* @covers ::can_manage_pledge
* @covers WordPressDotOrg\FiveForTheFuture\Auth\can_manage_pledge
*/
public function test_logged_in_admin_can_manage_pledge() {
$user = self::factory()->user->create(
@ -256,7 +256,7 @@ class Test_Auth extends WP_UnitTestCase {
}
/**
* @covers ::can_manage_pledge
* @covers WordPressDotOrg\FiveForTheFuture\Auth\can_manage_pledge
*/
public function test_logged_in_subscriber_cant_manage_pledge() {
$user = self::factory()->user->create(

View file

@ -49,8 +49,11 @@ class Test_Contributor extends WP_UnitTestCase {
}
/**
* @covers ::remove_pledge_contributors
* @covers ::remove_contributors
* @covers WordPressDotOrg\FiveForTheFuture\Contributor\remove_pledge_contributors
* @covers WordPressDotOrg\FiveForTheFuture\Contributor\remove_contributor
* @covers WordPressDotOrg\FiveForTheFuture\Contributor\add_pledge_contributors
* @covers WordPressDotOrg\FiveForTheFuture\XProfile\get_contributor_user_data
* @covers WordPressDotOrg\FiveForTheFuture\Pledge\deactivate
*/
public function test_data_reset_once_no_active_sponsors() : void {
// Setup scenario where Jane is sponsored by two companies.
@ -113,8 +116,11 @@ class Test_Contributor extends WP_UnitTestCase {
}
/**
* @covers ::remove_pledge_contributors
* @covers ::remove_contributors
* @covers WordPressDotOrg\FiveForTheFuture\Contributor\remove_pledge_contributors
* @covers WordPressDotOrg\FiveForTheFuture\Contributor\remove_contributor
* @covers WordPressDotOrg\FiveForTheFuture\Contributor\add_pledge_contributors
* @covers WordPressDotOrg\FiveForTheFuture\XProfile\get_contributor_user_data
* @covers WordPressDotOrg\FiveForTheFuture\Pledge\deactivate
*/
public function test_data_not_reset_when_unconfirmed_sponsor() : void {
// Setup scenario where Jane was invited to join a company but didn't respond.
@ -153,7 +159,9 @@ class Test_Contributor extends WP_UnitTestCase {
}
/**
* @covers ::remove_contributors
* @covers WordPressDotOrg\FiveForTheFuture\Contributor\remove_contributor
* @covers WordPressDotOrg\FiveForTheFuture\Contributor\add_pledge_contributors
* @covers WordPressDotOrg\FiveForTheFuture\XProfile\get_contributor_user_data
*/
public function test_data_reset_when_single_contributor_removed_from_pledge() : void {
// Setup scenario where Jane and Ashish are sponsored by a company.
@ -206,7 +214,7 @@ class Test_Contributor extends WP_UnitTestCase {
}
/**
* @covers ::prune_unnotifiable_users
* @covers WordPressDotOrg\FiveForTheFuture\Contributor\prune_unnotifiable_users
*/
public function test_prune_unnotifiable_users() {
$contributors = array(

View file

@ -43,7 +43,7 @@ class Test_Stats extends WP_UnitTestCase {
}
/**
* @covers ::get_snapshot_data
* @covers WordPressDotOrg\FiveForTheFuture\Stats\get_snapshot_data
*/
public function test_get_snapshot() : void {
// Setup 2 company-sponsored contributors.