From ea82f1a45ca441e4b3f2da3f6c411e16ddfa180d Mon Sep 17 00:00:00 2001 From: sect Date: Mon, 29 Apr 2024 18:21:19 +0900 Subject: [PATCH] test: add '@covers' annotations to test classes and methods --- tests/FunctionTests.php | 3 +++ tests/GoogleSpreadsheetToDBActivatorTests.php | 3 +++ tests/GoogleSpreadsheetToDBQueryTests.php | 8 ++++++++ 3 files changed, 14 insertions(+) diff --git a/tests/FunctionTests.php b/tests/FunctionTests.php index 3736cec..1aabf39 100644 --- a/tests/FunctionTests.php +++ b/tests/FunctionTests.php @@ -2,10 +2,12 @@ /** * Class FunctionsTest * Tests the functionality of functions in functions.php. + * @coversDefaultClass Functions */ class FunctionsTest extends WP_UnitTestCase { /** * @dataProvider providerTruncateMiddle + * @covers ::google_ss2db_truncate_middle */ public function test_google_ss2db_truncate_middle( $input, $max_chars, $expected ) { require_once 'functions/functions.php'; // Include the file where the function is defined. @@ -25,6 +27,7 @@ public function providerTruncateMiddle() { /** * Tests the output of the google_ss2db_options_pagination function. + * @covers ::google_ss2db_options_pagination */ public function testPaginationOutput() { // Pagination settings. diff --git a/tests/GoogleSpreadsheetToDBActivatorTests.php b/tests/GoogleSpreadsheetToDBActivatorTests.php index 9e002eb..fdb4841 100644 --- a/tests/GoogleSpreadsheetToDBActivatorTests.php +++ b/tests/GoogleSpreadsheetToDBActivatorTests.php @@ -5,12 +5,14 @@ * Class for testing the Google_Spreadsheet_To_DB_Activator activation functionality. * * This class extends WP_UnitTestCase to test the activation method of the Google_Spreadsheet_To_DB_Activator class. + * @covers Google_Spreadsheet_To_DB_Activator::activate */ class Test_Google_Spreadsheet_To_DB_Activator extends WP_UnitTestCase { /** * Test the activate method when no previous version is installed. + * @covers Google_Spreadsheet_To_DB_Activator::activate */ public function test_activate_no_previous_version() { global $wpdb; @@ -33,6 +35,7 @@ public function test_activate_no_previous_version() { /** * Test the activate method when the installed version is outdated. + * @covers Google_Spreadsheet_To_DB_Activator::activate */ public function test_activate_outdated_version() { global $wpdb; diff --git a/tests/GoogleSpreadsheetToDBQueryTests.php b/tests/GoogleSpreadsheetToDBQueryTests.php index 0e30190..f1f591d 100644 --- a/tests/GoogleSpreadsheetToDBQueryTests.php +++ b/tests/GoogleSpreadsheetToDBQueryTests.php @@ -4,6 +4,7 @@ /** * Class Test_Google_Spreadsheet_To_DB_Query * Tests the Google_Spreadsheet_To_DB_Query class functionality. + * @covers Google_Spreadsheet_To_DB_Query */ class Google_Spreadsheet_To_DB_Query_Test extends WP_UnitTestCase { protected $mock_data; @@ -53,6 +54,7 @@ public function setUp(): void { /** * Test getting all rows. + * @covers Google_Spreadsheet_To_DB_Query::getrow */ public function test_get_all_rows() { $sheet = $this->getMockBuilder( Google_Spreadsheet_To_DB_Query::class ) @@ -69,6 +71,7 @@ public function test_get_all_rows() { /** * Test getting 3 rows starting from the 4th row, ordered by ID in ascending order. + * @covers Google_Spreadsheet_To_DB_Query::getrow */ public function test_get_3_rows_from_4th_ascending_by_id() { $args = array( @@ -94,6 +97,7 @@ public function test_get_3_rows_from_4th_ascending_by_id() { /** * Test getting a row with a specific ID. + * @covers Google_Spreadsheet_To_DB_Query::getrow */ public function test_get_row_with_specific_id() { $args = array( @@ -128,6 +132,7 @@ function ( $row ) { /** * Test getting 3 rows with a specific worksheet name, ordered by ID. + * @covers Google_Spreadsheet_To_DB_Query::getrow */ public function test_get_3_rows_with_specific_worksheet_ordered_by_id() { $args = array( @@ -178,6 +183,7 @@ function ( $a, $b ) { /** * Test getting rows with a specific sheet name. + * @covers Google_Spreadsheet_To_DB_Query::getrow */ public function test_get_rows_with_specific_sheet_name() { $args = array( @@ -212,6 +218,7 @@ function ( $row ) { /** * Test getting rows with a specific title. + * @covers Google_Spreadsheet_To_DB_Query::getrow */ public function test_get_rows_with_specific_title() { $args = array( @@ -246,6 +253,7 @@ function ( $row ) { /** * Test getting the 2nd row with a date greater than or equal to '2023-06-03 12:00:00' and a specific worksheet name, ordered by ID in descending order. + * @covers Google_Spreadsheet_To_DB_Query::getrow */ public function test_get_2nd_row_with_date_gte_and_specific_worksheet_ordered_by_id_desc() { $args = array(