feat: add editorial query blocks
This commit is contained in:
24 files changed
+1421
No files matched your search
@@ -168,6 +168,49 @@ class TaxonomiesTest extends WP_UnitTestCase {
|
||||
$this->assertSame( '', ob_get_clean(), 'The notice should be consumed after one render.' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Appending a second editorial term still enforces the one-term contract.
|
||||
*/
|
||||
public function test_appending_an_editorial_term_normalizes_the_final_assignment() {
|
||||
$post_id = self::factory()->post->create();
|
||||
$first = self::factory()->term->create(
|
||||
array(
|
||||
'taxonomy' => 'chrnx_topic',
|
||||
'name' => 'Append first',
|
||||
)
|
||||
);
|
||||
$second = self::factory()->term->create(
|
||||
array(
|
||||
'taxonomy' => 'chrnx_topic',
|
||||
'name' => 'Append second',
|
||||
)
|
||||
);
|
||||
|
||||
wp_set_object_terms( $post_id, array( $second ), 'chrnx_topic' );
|
||||
wp_set_object_terms( $post_id, array( $first ), 'chrnx_topic', true );
|
||||
|
||||
$this->assertSame(
|
||||
array( min( $first, $second ) ),
|
||||
wp_get_object_terms( $post_id, 'chrnx_topic', array( 'fields' => 'ids' ) )
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Empty assignment and explicit deletion remain empty without synthetic terms.
|
||||
*/
|
||||
public function test_empty_assignment_and_term_deletion_remain_empty() {
|
||||
$post_id = self::factory()->post->create();
|
||||
$term_id = self::factory()->term->create( array( 'taxonomy' => 'chrnx_topic' ) );
|
||||
|
||||
wp_set_object_terms( $post_id, array( $term_id ), 'chrnx_topic' );
|
||||
wp_set_object_terms( $post_id, array(), 'chrnx_topic' );
|
||||
$this->assertSame( array(), wp_get_object_terms( $post_id, 'chrnx_topic', array( 'fields' => 'ids' ) ) );
|
||||
|
||||
wp_set_object_terms( $post_id, array( $term_id ), 'chrnx_topic' );
|
||||
wp_delete_object_term_relationships( $post_id, 'chrnx_topic' );
|
||||
$this->assertSame( array(), wp_get_object_terms( $post_id, 'chrnx_topic', array( 'fields' => 'ids' ) ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* A nested assignment for another post in the same taxonomy still normalizes.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user