wordpress-develop/tests/phpunit/tests/term/getEditTermLink.php
John Blackbourn c5a336d664 Use WP_TESTS_DOMAIN where it should be used in tests in place of hard-coded uses of example.org.
Also corrects a test value in the data provider for `Tests_Sanitize_Option::test_sanitize_option()` which was only consequentially passing.

Fixes #34000


git-svn-id: https://develop.svn.wordpress.org/trunk@34519 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-24 21:01:10 +00:00

55 lines
1.3 KiB
PHP

<?php
/**
* @group taxonomy
*/
class Tests_Term_GetEditTermLink extends WP_UnitTestCase {
public function setUp() {
parent::setUp();
wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
register_taxonomy( 'wptests_tax', 'post' );
}
public function test_get_edit_term_link_default() {
$term1 = $this->factory->term->create( array(
'taxonomy' => 'wptests_tax',
'name' => 'foo',
) );
$actual = get_edit_term_link( $term1, 'wptests_tax' );
$expected = 'http://' . WP_TESTS_DOMAIN . '/wp-admin/edit-tags.php?action=edit&taxonomy=wptests_tax&tag_ID=' . $term1 . '&post_type=post';
$this->assertEquals( $expected, $actual );
}
/**
* @ticket 32786
*/
public function test_get_edit_term_link_invalid_id() {
$term1 = $this->factory->term->create( array(
'taxonomy' => 'wptests_tax',
'name' => 'foo',
) );
$actual = get_edit_term_link( 12345, 'wptests_tax' );
$this->assertNull( $actual );
}
/**
* @ticket 32786
*/
public function test_get_edit_term_link_empty_id() {
$actual = get_edit_term_link( '', 'wptests_tax' );
$this->assertNull( $actual );
}
/**
* @ticket 32786
*/
public function test_get_edit_term_link_bad_tax() {
$actual = get_edit_term_link( '', 'bad_tax' );
$this->assertNull( $actual );
}
}