Index: tests/phpunit/tests/dependencies/jquery.php
===================================================================
--- tests/phpunit/tests/dependencies/jquery.php	(revision 33848)
+++ tests/phpunit/tests/dependencies/jquery.php	(working copy)
@@ -81,4 +81,37 @@
 
 		unset( $GLOBALS['wp_scripts'] );
 	}
+
+	/**
+	 * Test placing of jquery in footer.
+	 * @ticket 25247
+	 */
+	function test_jquery_in_footer() {
+		$scripts = new WP_Scripts;
+		$scripts->add( 'jquery', false, array( 'jquery-core', 'jquery-migrate' ) );
+		$scripts->add( 'jquery-core', '/jquery.js', array() );
+		$scripts->add( 'jquery-migrate', "/jquery-migrate.js", array() );
+
+		$scripts->enqueue( 'jquery' );
+
+		$object = $scripts->query( 'jquery' );
+		$object->add_data( 'group', 1 );
+		foreach( $object->deps as $dep ) {
+			$scripts->add_data( $dep, 'group', 1 );
+		}
+
+		ob_start();
+
+		$scripts->do_items( false, 0 );
+		// Could do $this->assertContains( 'jquery', $scripts->done );
+		$this->assertNotContains( 'jquery-core', $scripts->done, 'jquery-core should be in footer but is in head' );
+		$this->assertNotContains( 'jquery-migrate', $scripts->done, 'jquery-migrate should be in footer but is in head' );
+
+		$scripts->do_items( false, 1 );
+		$this->assertContains( 'jquery', $scripts->done );
+		$this->assertContains( 'jquery-core', $scripts->done, 'jquery-core in footer' );
+		$this->assertContains( 'jquery-migrate', $scripts->done, 'jquery-migrate in footer' );
+
+		ob_end_clean();
+	}
 }
Index: tests/phpunit/tests/dependencies/scripts.php
===================================================================
--- tests/phpunit/tests/dependencies/scripts.php	(revision 33848)
+++ tests/phpunit/tests/dependencies/scripts.php	(working copy)
@@ -156,6 +156,53 @@
 		$this->assertEquals( '', get_echo( 'wp_print_scripts' ) );
 	}
 
+	/**
+	 * Test mismatch of groups in dependencies outputs all scripts in right order.
+	 * @ticket 25247
+	 */
+	public function test_group_mismatch_in_deps() {
+		$scripts = new WP_Scripts;
+		$scripts->add( 'one', 'one', array(), 'v1', 1 ); 
+		$scripts->add( 'two', 'two', array( 'one' ) ); 
+		$scripts->add( 'three', 'three', array( 'two' ), 'v1', 1 ); 
+
+		$scripts->enqueue( array( 'three' ) );
+
+		ob_start();
+
+		$scripts->do_items( false, 0 );
+		$this->assertContains( 'one', $scripts->done );
+		$this->assertContains( 'two', $scripts->done );
+		$this->assertNotContains( 'three', $scripts->done );
+
+		$scripts->do_items( false, 1 );
+		$this->assertContains( 'one', $scripts->done );
+		$this->assertContains( 'two', $scripts->done );
+		$this->assertContains( 'three', $scripts->done );
+
+		$scripts = new WP_Scripts;
+		$scripts->add( 'one', 'one', array(), 'v1', 1 ); 
+		$scripts->add( 'two', 'two', array( 'one' ), 'v1', 1 ); 
+		$scripts->add( 'three', 'three', array( 'one' ) ); 
+		$scripts->add( 'four', 'four', array( 'two', 'three' ), 'v1', 1 ); 
+
+		$scripts->enqueue( array( 'four' ) );
+
+		$scripts->do_items( false, 0 );
+		$this->assertContains( 'one', $scripts->done );
+		$this->assertNotContains( 'two', $scripts->done );
+		$this->assertContains( 'three', $scripts->done );
+		$this->assertNotContains( 'four', $scripts->done );
+
+		$scripts->do_items( false, 1 );
+		$this->assertContains( 'one', $scripts->done );
+		$this->assertContains( 'two', $scripts->done );
+		$this->assertContains( 'three', $scripts->done );
+		$this->assertContains( 'four', $scripts->done );
+
+		ob_end_clean();
+	}
+
     /**
      * Testing 'wp_register_script' return boolean success/failure value.
      *
