fix: harden CHRNX editor lifecycle

This commit is contained in:
chrnx committed 2026-08-11 15:06:50 -05:00
1 parent a5b94123a8
commit 835fb74ebf
12 files changed
+512 -95

No files matched your search

+18 -1
View File
@@ -27,10 +27,14 @@ class PodcastMetaTest extends WP_UnitTestCase {
$this->assertSame( 0, $registered['chrnx_episode_number']['show_in_rest']['schema']['minimum'] );
$this->assertSame( 'string', $registered['chrnx_episode_duration']['show_in_rest']['schema']['type'] );
$this->assertSame(
array( 'type' => 'string' ),
array(
'type' => 'string',
'maxLength' => 100,
),
$registered['chrnx_episode_participants']['show_in_rest']['schema']['items']
);
$this->assertSame( 'array', $registered['chrnx_episode_participants']['show_in_rest']['schema']['type'] );
$this->assertSame( 50, $registered['chrnx_episode_participants']['show_in_rest']['schema']['maxItems'] );
$this->assertSame( 'string', $registered['canonical_episode_url']['show_in_rest']['schema']['type'] );
$this->assertArrayNotHasKey( 'chrnx_buzzsprout_embed', $registered );
$this->assertArrayNotHasKey( 'chrnx_episode_player', $registered );
@@ -78,6 +82,19 @@ class PodcastMetaTest extends WP_UnitTestCase {
$this->assertSame( array(), chrnx_sanitize_episode_participants( 'Ada Example' ) );
}
/**
* Participant bounds preserve Unicode and intentional order.
*/
public function test_participants_are_bounded_by_count_and_unicode_length() {
$long_name = str_repeat( 'ñ', 101 );
$input = array_merge( array( $long_name ), array_fill( 0, 55, 'Guest' ) );
$actual = chrnx_sanitize_episode_participants( $input );
$this->assertCount( 50, $actual );
$this->assertSame( str_repeat( 'ñ', 100 ), $actual[0] );
$this->assertSame( 100, mb_strlen( $actual[0], 'UTF-8' ) );
}
/**
* Canonical URLs allow HTTPS only.
*/