Changeset 59966 for trunk/tests/phpunit/tests/general/paginateLinks.php
- Timestamp:
- 03/11/2025 11:10:00 AM (2 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/general/paginateLinks.php
r52010 r59966 363 363 $this->assertContains( "<a class=\"page-numbers\" href=\"$page_2_url\">2</a>", $links ); 364 364 } 365 366 /** 367 * @ticket 61393 368 */ 369 public function test_pagination_links_with_trailing_slash() { 370 $this->set_permalink_structure( '/%postname%/' ); 371 372 $args = array( 373 'base' => 'http://example.org/category/test/%_%', 374 'format' => 'page/%#%', 375 'total' => 5, 376 'current' => 2, 377 'prev_next' => true, 378 ); 379 380 $links = paginate_links( $args ); 381 382 // Test page 1 link (should have trailing slash) 383 $this->assertStringContainsString( 384 'href="http://example.org/category/test/"', 385 $links, 386 'Page 1 link should have trailing slash when permalink structure has trailing slash' 387 ); 388 389 // Test page 3 link (should have trailing slash) 390 $this->assertStringContainsString( 391 'href="http://example.org/category/test/page/3/"', 392 $links, 393 'Page 3 link should have trailing slash when permalink structure has trailing slash' 394 ); 395 396 // Test previous link (should have trailing slash) 397 $this->assertStringContainsString( 398 'class="prev page-numbers" href="http://example.org/category/test/"', 399 $links, 400 'Previous link should have trailing slash when permalink structure has trailing slash' 401 ); 402 } 403 404 /** 405 * @ticket 61393 406 */ 407 public function test_pagination_links_without_trailing_slash() { 408 $this->set_permalink_structure( '/%postname%' ); 409 410 $args = array( 411 'base' => 'http://example.org/category/test/%_%', 412 'format' => 'page/%#%', 413 'total' => 5, 414 'current' => 2, 415 'prev_next' => true, 416 ); 417 418 $links = paginate_links( $args ); 419 420 // Test page 1 link (should not have trailing slash) 421 $this->assertStringContainsString( 422 'href="http://example.org/category/test"', 423 $links, 424 'Page 1 link should not have trailing slash when permalink structure has no trailing slash' 425 ); 426 427 // Test page 3 link (should not have trailing slash) 428 $this->assertStringContainsString( 429 'href="http://example.org/category/test/page/3"', 430 $links, 431 'Page 3 link should not have trailing slash when permalink structure has no trailing slash' 432 ); 433 434 // Test previous link (should not have trailing slash) 435 $this->assertStringContainsString( 436 'class="prev page-numbers" href="http://example.org/category/test"', 437 $links, 438 'Previous link should not have trailing slash when permalink structure has no trailing slash' 439 ); 440 } 365 441 }
Note: See TracChangeset
for help on using the changeset viewer.