Make WordPress Core

Ticket #20449: 20449-ut.diff

File 20449-ut.diff, 1.3 KB (added by ryan, 13 years ago)
  • tests/admin/includesFile.php

     
     1<?php
     2
     3/**
     4 * @group file
     5 * @group admin
     6 */
     7class Tests_Admin_includesFile extends WP_UnitTestCase {
     8
     9        function setUp() {
     10                parent::setUp();
     11        }
     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( ABSPATH, get_home_path() );
     18
     19                update_option( 'home', 'http://localhost' );
     20                update_option( 'siteurl', 'http://localhost/wp' );
     21
     22                $_SERVER['SCRIPT_FILENAME'] = 'D:\root\vhosts\site\httpdocs\wp\wp-admin\options-permalink.php';
     23                $this->assertEquals( 'D:\root\vhosts\site\httpdocs/', get_home_path() );
     24
     25                $_SERVER['SCRIPT_FILENAME'] = '/Users/foo/public_html/trunk/wp/wp-admin/options-permalink.php';
     26                $this->assertEquals( '/Users/foo/public_html/trunk/', get_home_path() );
     27
     28                $_SERVER['SCRIPT_FILENAME'] = 'S:/home/wordpress/trunk/wp/wp-admin/options-permalink.php';
     29                $this->assertEquals( 'S:/home/wordpress/trunk/', get_home_path() );
     30        }
     31}
     32 No newline at end of file