Code is Poetry.

WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.



git-svn-id: https://develop.svn.wordpress.org/trunk@42343 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast
2017-11-30 23:09:33 +00:00
parent ec6a089f98
commit 8f95800d52
1103 changed files with 105978 additions and 78184 deletions
+9 -8
View File
@@ -23,7 +23,8 @@ class Tests_Term_GetTerm extends WP_UnitTestCase {
$t2 = wp_insert_term( 'Foo', 'wptests_tax_2' );
// Manually modify because shared terms shouldn't naturally occur.
$wpdb->update( $wpdb->term_taxonomy,
$wpdb->update(
$wpdb->term_taxonomy,
array( 'term_id' => $t1['term_id'] ),
array( 'term_taxonomy_id' => $t2['term_taxonomy_id'] ),
array( '%d' ),
@@ -32,13 +33,13 @@ class Tests_Term_GetTerm extends WP_UnitTestCase {
return array(
array(
'term_id' => $t1['term_id'],
'old_term_id' => $t1['term_id'],
'term_id' => $t1['term_id'],
'old_term_id' => $t1['term_id'],
'term_taxonomy_id' => $t1['term_taxonomy_id'],
),
array(
'term_id' => $t1['term_id'],
'old_term_id' => $t2['term_id'],
'term_id' => $t1['term_id'],
'old_term_id' => $t2['term_id'],
'term_taxonomy_id' => $t2['term_taxonomy_id'],
),
);
@@ -85,7 +86,7 @@ class Tests_Term_GetTerm extends WP_UnitTestCase {
clean_term_cache( $t, 'wptests_tax' );
// Prime cache.
$term_a = get_term( $t, 'wptests_tax' );
$term_a = get_term( $t, 'wptests_tax' );
$num_queries = $wpdb->num_queries;
// Second call shouldn't require a database query.
@@ -100,14 +101,14 @@ class Tests_Term_GetTerm extends WP_UnitTestCase {
}
public function test_output_array_a() {
$t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) );
$t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) );
$term = get_term( $t, 'wptests_tax', ARRAY_A );
$this->assertInternalType( 'array', $term );
$this->assertTrue( isset( $term['term_id'] ) );
}
public function test_output_array_n() {
$t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) );
$t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) );
$term = get_term( $t, 'wptests_tax', ARRAY_N );
$this->assertInternalType( 'array', $term );
$this->assertFalse( isset( $term['term_id'] ) );