mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
This aims to bring some consistency to the location of category function tests, as well as to make the tests more discoverable and easier to expand. Follow-up to [28438], [28566], [31006], [31025], [37464], [28438], [31299], [36988], [42364], [42367], [42368], [46413], [53684]. See #56793. git-svn-id: https://develop.svn.wordpress.org/trunk@54717 602fd350-edb4-49c9-b593-d223f7449a82
30 lines
570 B
PHP
30 lines
570 B
PHP
<?php
|
|
/**
|
|
* @group taxonomy
|
|
* @group category.php
|
|
*
|
|
* @covers ::get_cat_ID
|
|
*/
|
|
class Tests_Category_GetCatId extends WP_UnitTestCase {
|
|
|
|
/**
|
|
* Validate get_cat_ID function
|
|
*/
|
|
public function test_get_cat_ID() {
|
|
|
|
// Create test category.
|
|
$testcat = self::factory()->category->create_and_get(
|
|
array(
|
|
'slug' => 'testcat',
|
|
'name' => 'Test Category 1',
|
|
)
|
|
);
|
|
|
|
// Validate.
|
|
$this->assertSame( $testcat->term_id, get_cat_ID( $testcat->name ) );
|
|
$this->assertSame( 0, get_cat_ID( 'NO CAT' ) );
|
|
$this->assertSame( 0, get_cat_ID( 12 ) );
|
|
|
|
}
|
|
}
|