Index: tests/admin/includesScreen.php
===================================================================
--- tests/admin/includesScreen.php	(revision 1035)
+++ tests/admin/includesScreen.php	(working copy)
@@ -5,33 +5,63 @@
  */
 class Tests_Admin_includesScreen extends WP_UnitTestCase {
 	var $core_screens = array(
-		'index.php' => array( 'base' => 'dashboard', 'id' => 'dashboard' ),
-		'edit.php' => array( 'base' => 'edit', 'id' => 'edit-post', 'post_type' => 'post' ),
-		'post-new.php'=> array( 'action' => 'add', 'base' => 'post', 'id' => 'post', 'post_type' => 'post' ),
-		'edit-tags.php' => array( 'base' => 'edit-tags', 'id' => 'edit-post_tag', 'post_type' => 'post', 'taxonomy' => 'post_tag' ),
-		'edit-tags.php?taxonomy=post_tag' => array( 'base' => 'edit-tags', 'id' => 'edit-post_tag', 'post_type' => 'post', 'taxonomy' => 'post_tag' ),
-		'edit-tags.php?taxonomy=category' => array( 'base' => 'edit-tags', 'id' => 'edit-category', 'post_type' => 'post', 'taxonomy' => 'category' ),
-		'upload.php' => array( 'base' => 'upload', 'id' => 'upload' ),
-		'media-new.php' => array( 'action' => 'add', 'base' => 'media', 'id' => 'media' ),
-		'edit.php?post_type=page' => array( 'base' => 'edit', 'id' => 'edit-page', 'post_type' => 'page' ),
-		'link-manager.php' => array( 'base' => 'link-manager', 'id' => 'link-manager' ),
-		'link-add.php' => array( 'action' => 'add', 'base' => 'link', 'id' => 'link' ),
-		'edit-tags.php?taxonomy=link_category' => array( 'base' => 'edit-tags', 'id' => 'edit-link_category', 'taxonomy' => 'link_category' ),
-		'edit-comments.php' => array( 'base' => 'edit-comments', 'id' => 'edit-comments' ),
-		'themes.php' => array( 'base' => 'themes', 'id' => 'themes' ),
-		'widgets.php' => array( 'base' => 'widgets', 'id' => 'widgets' ),
-		'nav-menus.php' => array( 'base' => 'nav-menus', 'id' => 'nav-menus' ),
-		'plugins.php' => array( 'base' => 'plugins', 'id' => 'plugins' ),
-		'users.php' => array( 'base' => 'users', 'id' => 'users' ),
-		'user-new.php' => array( 'action' => 'add', 'base' => 'user', 'id' => 'user' ),
-		'profile.php' => array( 'base' => 'profile', 'id' => 'profile' ),
-		'tools.php' => array( 'base' => 'tools', 'id' => 'tools' ),
-		'import.php' => array( 'base' => 'import', 'id' => 'import' ),
-		'export.php' => array( 'base' => 'export', 'id' => 'export' ),
-		'options-general.php' => array( 'base' => 'options-general', 'id' => 'options-general' ),
-		'options-writing.php' => array( 'base' => 'options-writing', 'id' => 'options-writing' ),
+		'index.php' => array( 'base' => 'dashboard', 'id' => 'dashboard', 'guid' => 'site:dashboard' ),
+		'edit.php' => array( 'base' => 'edit', 'id' => 'edit-post', 'post_type' => 'post', 'guid' => 'site:edit:post' ),
+		'post-new.php'=> array( 'action' => 'add', 'base' => 'post', 'id' => 'post', 'post_type' => 'post', 'guid' => 'site:post:post' ),
+		'edit-tags.php' => array( 'base' => 'edit-tags', 'id' => 'edit-post_tag', 'post_type' => 'post', 'taxonomy' => 'post_tag', 'guid' => 'site:edit-tags:post_tag:post' ),
+		'edit-tags.php?taxonomy=post_tag' => array( 'base' => 'edit-tags', 'id' => 'edit-post_tag', 'post_type' => 'post', 'taxonomy' => 'post_tag', 'guid' => 'site:edit-tags:post_tag:post' ),
+		'edit-tags.php?taxonomy=category' => array( 'base' => 'edit-tags', 'id' => 'edit-category', 'post_type' => 'post', 'taxonomy' => 'category', 'guid' => 'site:edit-tags:category:post' ),
+		'upload.php' => array( 'base' => 'upload', 'id' => 'upload', 'guid' => 'site:upload' ),
+		'media-new.php' => array( 'action' => 'add', 'base' => 'media', 'id' => 'media', 'guid' => 'site:media' ),
+		'edit.php?post_type=page' => array( 'base' => 'edit', 'id' => 'edit-page', 'post_type' => 'page', 'guid' => 'site:edit:page' ),
+		'link-manager.php' => array( 'base' => 'link-manager', 'id' => 'link-manager', 'guid' => 'site:link-manager' ),
+		'link-add.php' => array( 'action' => 'add', 'base' => 'link', 'id' => 'link', 'guid' => 'site:link' ),
+		'edit-tags.php?taxonomy=link_category' => array( 'base' => 'edit-tags', 'id' => 'edit-link_category', 'taxonomy' => 'link_category', 'guid' => 'site:edit-tags:link_category' ),
+		'edit-comments.php' => array( 'base' => 'edit-comments', 'id' => 'edit-comments', 'guid' => 'site:edit-comments' ),
+		'themes.php' => array( 'base' => 'themes', 'id' => 'themes', 'guid' => 'site:themes' ),
+		'widgets.php' => array( 'base' => 'widgets', 'id' => 'widgets', 'guid' => 'site:widgets' ),
+		'nav-menus.php' => array( 'base' => 'nav-menus', 'id' => 'nav-menus', 'guid' => 'site:nav-menus' ),
+		'plugins.php' => array( 'base' => 'plugins', 'id' => 'plugins', 'guid' => 'site:plugins' ),
+		'users.php' => array( 'base' => 'users', 'id' => 'users', 'guid' => 'site:users' ),
+		'user-new.php' => array( 'action' => 'add', 'base' => 'user', 'id' => 'user', 'guid' => 'site:user' ),
+		'profile.php' => array( 'base' => 'profile', 'id' => 'profile', 'guid' => 'site:profile' ),
+		'tools.php' => array( 'base' => 'tools', 'id' => 'tools', 'guid' => 'site:tools' ),
+		'import.php' => array( 'base' => 'import', 'id' => 'import', 'guid' => 'site:import' ),
+		'export.php' => array( 'base' => 'export', 'id' => 'export', 'guid' => 'site:export' ),
+		'options-general.php' => array( 'base' => 'options-general', 'id' => 'options-general', 'guid' => 'site:options-general' ),
+		'options-writing.php' => array( 'base' => 'options-writing', 'id' => 'options-writing', 'guid' => 'site:options-writing' ),
 	);
 
+	var $core_screens_guid = array(
+		'site:dashboard' => array( 'base' => 'dashboard', 'id' => 'dashboard' ),
+		'site:edit:post' => array( 'base' => 'edit', 'id' => 'edit-post', 'post_type' => 'post' ),
+		'site:post:post'=> array( 'action' => 'add', 'base' => 'post', 'id' => 'post', 'post_type' => 'post' ),
+		'site:edit-tags:post_tag:post' => array( 'base' => 'edit-tags', 'id' => 'edit-post_tag', 'post_type' => 'post', 'taxonomy' => 'post_tag' ),
+		'site:edit-tags:category:post' => array( 'base' => 'edit-tags', 'id' => 'edit-category', 'post_type' => 'post', 'taxonomy' => 'category' ),
+		'site:upload' => array( 'base' => 'upload', 'id' => 'upload' ),
+		'site:media' => array( 'action' => 'add', 'base' => 'media', 'id' => 'media' ),
+		'site:edit:page' => array( 'base' => 'edit', 'id' => 'edit-page', 'post_type' => 'page' ),
+		'site:link-manager' => array( 'base' => 'link-manager', 'id' => 'link-manager' ),
+		'site:link' => array( 'action' => 'add', 'base' => 'link', 'id' => 'link' ),
+		'site:edit-tags:link_category' => array( 'base' => 'edit-tags', 'id' => 'edit-link_category', 'taxonomy' => 'link_category' ),
+		'site:edit-comments' => array( 'base' => 'edit-comments', 'id' => 'edit-comments' ),
+		'site:themes' => array( 'base' => 'themes', 'id' => 'themes' ),
+		'site:widgets' => array( 'base' => 'widgets', 'id' => 'widgets' ),
+		'site:nav-menus' => array( 'base' => 'nav-menus', 'id' => 'nav-menus' ),
+		'site:plugins' => array( 'base' => 'plugins', 'id' => 'plugins' ),
+		'site:users' => array( 'base' => 'users', 'id' => 'users' ),
+		'site:user' => array( 'action' => 'add', 'base' => 'user', 'id' => 'user' ),
+		'site:profile' => array( 'base' => 'profile', 'id' => 'profile' ),
+		'site:tools' => array( 'base' => 'tools', 'id' => 'tools' ),
+		'site:import' => array( 'base' => 'import', 'id' => 'import' ),
+		'site:export' => array( 'base' => 'export', 'id' => 'export' ),
+		'site:options-general' => array( 'base' => 'options-general', 'id' => 'options-general' ),
+		'site:options-writing' => array( 'base' => 'options-writing', 'id' => 'options-writing' ),
+		'network:dashboard' => array( 'base' => 'dashboard-network', 'id' => 'dashboard-network', 'in_admin' => 'network' ),
+		'network:sites' => array( 'base' => 'sites-network', 'id' => 'sites-network', 'in_admin' => 'network' ),
+		'user:dashboard' => array( 'base' => 'dashboard-user', 'id' => 'dashboard-user', 'in_admin' => 'user' ),
+	);
+
 	function setUp() {
 		set_current_screen( 'front' );
 	}
@@ -74,6 +104,8 @@
 				$this->assertEmpty( $current_screen->post_type, $hook_name );
 			if ( isset( $screen->taxonomy ) )
 				$this->assertEquals( $screen->taxonomy, $current_screen->taxonomy, $hook_name );
+			if ( isset( $screen->guid ) )
+				$this->assertEquals( $screen->guid, $current_screen->guid, $hook_name );
 
 			$this->assertTrue( $current_screen->in_admin() );
 			$this->assertTrue( $current_screen->in_admin( 'site' ) );
@@ -91,6 +123,28 @@
 		}
 	}
 
+	function test_set_current_screen_with_guid() {
+		global $current_screen;
+
+		foreach ( $this->core_screens_guid as $guid => $screen ) {
+			$screen = (object) $screen;
+			set_current_screen( $guid );
+			$this->assertEquals( $screen->id, $current_screen->id, $guid );
+			$this->assertEquals( $screen->base, $current_screen->base, $guid );
+			if ( isset( $screen->action ) )
+				$this->assertEquals( $screen->action, $current_screen->action, $guid );
+			if ( isset( $screen->post_type ) )
+				$this->assertEquals( $screen->post_type, $current_screen->post_type, $guid );
+			else
+				$this->assertEmpty( $current_screen->post_type, $guid );
+			if ( isset( $screen->taxonomy ) )
+				$this->assertEquals( $screen->taxonomy, $current_screen->taxonomy, $guid );
+
+			// With convert_to_screen(), the same ID should return the exact $current_screen.
+			$this->assertSame( $current_screen, convert_to_screen( $screen->id ), $guid );
+		}
+	}
+
 	function test_post_type_as_hookname() {
 		$screen = convert_to_screen( 'page' );
 		$this->assertEquals( $screen->post_type, 'page' );
