includesFile.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * @group file
  4. * @group admin
  5. */
  6. class Tests_Admin_includesFile extends WP_UnitTestCase {
  7. function setUp() {
  8. parent::setUp();
  9. }
  10. /**
  11. * @ticket 20449
  12. */
  13. function test_get_home_path() {
  14. $home = get_option( 'home' );
  15. $siteurl = get_option( 'siteurl' );
  16. $sfn = $_SERVER['SCRIPT_FILENAME'];
  17. $this->assertEquals( str_replace( '\\', '/', ABSPATH ), get_home_path() );
  18. update_option( 'home', 'http://localhost' );
  19. update_option( 'siteurl', 'http://localhost/wp' );
  20. $_SERVER['SCRIPT_FILENAME'] = 'D:\root\vhosts\site\httpdocs\wp\wp-admin\options-permalink.php';
  21. $this->assertEquals( 'D:/root/vhosts/site/httpdocs/', get_home_path() );
  22. $_SERVER['SCRIPT_FILENAME'] = '/Users/foo/public_html/trunk/wp/wp-admin/options-permalink.php';
  23. $this->assertEquals( '/Users/foo/public_html/trunk/', get_home_path() );
  24. $_SERVER['SCRIPT_FILENAME'] = 'S:/home/wordpress/trunk/wp/wp-admin/options-permalink.php';
  25. $this->assertEquals( 'S:/home/wordpress/trunk/', get_home_path() );
  26. update_option( 'home', $home );
  27. update_option( 'siteurl', $siteurl );
  28. $_SERVER['SCRIPT_FILENAME'] = $sfn;
  29. }
  30. }