| | 478 | * When the path for a site is updated with update_blog_details(), the final |
| | 479 | * path should have a leading and trailing slash. When multiple directories |
| | 480 | * are part of the path, only one slash should separate each directory. |
| | 481 | * |
| | 482 | * @ticket 18117 |
| | 483 | */ |
| | 484 | function test_update_blog_details_single_path_no_slashes() { |
| | 485 | update_blog_details( 1, array( 'path' => 'my_path' ) ); |
| | 486 | $blog = get_blog_details( 1 ); |
| | 487 | $this->assertEquals( '/my_path/', $blog->path ); |
| | 488 | } |
| | 489 | |
| | 490 | function test_update_blog_details_single_path_double_trailing_slashes() { |
| | 491 | update_blog_details( 1, array( 'path' => 'my_path//' ) ); |
| | 492 | $blog = get_blog_details( 1 ); |
| | 493 | $this->assertEquals( '/my_path/', $blog->path ); |
| | 494 | } |
| | 495 | |
| | 496 | function test_update_blog_details_single_path_double_leading_slashes() { |
| | 497 | update_blog_details( 1, array( 'path' => '//my_path' ) ); |
| | 498 | $blog = get_blog_details( 1 ); |
| | 499 | $this->assertEquals( '/my_path/', $blog->path ); |
| | 500 | } |
| | 501 | |
| | 502 | function test_update_blog_details_single_path_single_trailing_slash() { |
| | 503 | update_blog_details( 1, array( 'path' => 'my_path/' ) ); |
| | 504 | $blog = get_blog_details( 1 ); |
| | 505 | $this->assertEquals( '/my_path/', $blog->path ); |
| | 506 | } |
| | 507 | |
| | 508 | function test_update_blog_details_single_path_single_leading_slashes() { |
| | 509 | update_blog_details( 1, array( 'path' => '/my_path' ) ); |
| | 510 | $blog = get_blog_details( 1 ); |
| | 511 | $this->assertEquals( '/my_path/', $blog->path ); |
| | 512 | } |
| | 513 | |
| | 514 | function test_update_blog_details_single_path_both_slashes() { |
| | 515 | update_blog_details( 1, array( 'path' => '/my_path/' ) ); |
| | 516 | $blog = get_blog_details( 1 ); |
| | 517 | $this->assertEquals( '/my_path/', $blog->path ); |
| | 518 | } |
| | 519 | |
| | 520 | function test_update_blog_details_multiple_paths_no_slashes() { |
| | 521 | update_blog_details( 1, array( 'path' => 'multiple/dirs' ) ); |
| | 522 | $blog = get_blog_details( 1 ); |
| | 523 | $this->assertEquals( '/multiple/dirs/', $blog->path ); |
| | 524 | } |
| | 525 | |
| | 526 | function test_update_blog_details_multiple_paths_middle_slashes() { |
| | 527 | update_blog_details( 1, array( 'path' => 'multiple///dirs' ) ); |
| | 528 | $blog = get_blog_details( 1 ); |
| | 529 | $this->assertEquals( '/multiple/dirs/', $blog->path ); |
| | 530 | } |
| | 531 | |
| | 532 | function test_update_blog_details_multiple_paths_leading_slash() { |
| | 533 | update_blog_details( 1, array( 'path' => '/multiple/dirs' ) ); |
| | 534 | $blog = get_blog_details( 1 ); |
| | 535 | $this->assertEquals( '/multiple/dirs/', $blog->path ); |
| | 536 | } |
| | 537 | |
| | 538 | function test_update_blog_details_multiple_paths_trailing_slash() { |
| | 539 | update_blog_details( 1, array( 'path' => 'multiple/dirs/' ) ); |
| | 540 | $blog = get_blog_details( 1 ); |
| | 541 | $this->assertEquals( '/multiple/dirs/', $blog->path ); |
| | 542 | } |
| | 543 | |
| | 544 | function test_update_blog_details_multiple_paths_both_slashes() { |
| | 545 | update_blog_details( 1, array( 'path' => '/multiple/dirs/' ) ); |
| | 546 | $blog = get_blog_details( 1 ); |
| | 547 | $this->assertEquals( '/multiple/dirs/', $blog->path ); |
| | 548 | } |
| | 549 | |
| | 550 | /** |