wordpress-develop/tests/phpunit/tests/category/getCatName.php
Sergey Biryukov 2a6b527f73 Tests: Improve the @group annotation accuracy and consistency.
Includes removing `.php` from some older group names, because most of the groups are no longer named based on the file containing the function, and sometimes functions move around, making the file-based group name inaccurate.

Props afercia, aristath, poena, SergeyBiryukov.
See #59647.

git-svn-id: https://develop.svn.wordpress.org/trunk@56971 602fd350-edb4-49c9-b593-d223f7449a82
2023-10-19 13:51:04 +00:00

29 lines
596 B
PHP

<?php
/**
* @group taxonomy
* @group category
*
* @covers ::get_cat_name
*/
class Tests_Category_GetCatName extends WP_UnitTestCase {
/**
* Validate get_cat_name function
*/
public function test_get_cat_name() {
// Create test category.
$testcat = self::factory()->category->create_and_get(
array(
'slug' => 'testcat',
'name' => 'Test Category 1',
)
);
// Validate.
$this->assertSame( $testcat->name, get_cat_name( $testcat->term_id ) );
$this->assertSame( '', get_cat_name( -1 ) );
$this->assertSame( '', get_cat_name( $testcat->term_id + 100 ) );
}
}