fix: validate CHRNX editorial fallbacks
This commit is contained in:
8 files changed
+232
-17
No files matched your search
@@ -176,6 +176,18 @@ class EditorialQueriesTest extends WP_UnitTestCase {
|
||||
$this->assertStringNotContainsString( '<', $search );
|
||||
}
|
||||
|
||||
/** Journal pages accept only canonical positive integers within the public bound. */
|
||||
public function test_journal_query_rejects_noncanonical_or_out_of_range_pages() {
|
||||
foreach ( array( '3junk', '0', 0, '-2', -2, '3.0', 3.0, '+3', '03', array( '3' ), '10001', 10001 ) as $invalid ) {
|
||||
$args = chrnx_get_journal_query_args( array( 'paged' => $invalid ) );
|
||||
$this->assertSame( 1, $args['paged'], 'Invalid page values must fail closed.' );
|
||||
}
|
||||
|
||||
$this->assertSame( 3, chrnx_get_journal_query_args( array( 'paged' => '3' ) )['paged'] );
|
||||
$this->assertSame( 10000, chrnx_get_journal_query_args( array( 'paged' => '10000' ) )['paged'] );
|
||||
$this->assertSame( 10000, chrnx_get_journal_query_args( array( 'paged' => 10000 ) )['paged'] );
|
||||
}
|
||||
|
||||
/** Related stories tier by topic, then tags, then recency without duplicates. */
|
||||
public function test_related_posts_use_ordered_deduplicated_tiers_and_eligibility() {
|
||||
$current = $this->create_post( 'Current', '2026-03-05 10:00:00', 'research' );
|
||||
|
||||
Reference in new issue
Block a user