Index: trunk/tests/phpunit/tests/admin/includesPost.php
===================================================================
--- trunk/tests/phpunit/tests/admin/includesPost.php	(revision 41187)
+++ trunk/tests/phpunit/tests/admin/includesPost.php	(revision 42343)
@@ -27,7 +27,7 @@
 
 		// Create New Draft Post
-		$_post_data = array();
+		$_post_data                = array();
 		$_post_data['post_author'] = self::$contributor_id;
-		$_post_data['post_type'] = 'post';
+		$_post_data['post_type']   = 'post';
 		$_post_data['saveasdraft'] = true;
 
@@ -38,8 +38,8 @@
 
 		// Submit Post for Approval
-		$_post_data = array();
+		$_post_data                = array();
 		$_post_data['post_author'] = self::$contributor_id;
-		$_post_data['post_type'] = 'post';
-		$_post_data['publish'] = true;
+		$_post_data['post_type']   = 'post';
+		$_post_data['publish']     = true;
 
 		$_results = _wp_translate_postdata( false, $_post_data );
@@ -49,7 +49,7 @@
 
 		// Create New Draft Post for another user
-		$_post_data = array();
+		$_post_data                = array();
 		$_post_data['post_author'] = self::$editor_id;
-		$_post_data['post_type'] = 'post';
+		$_post_data['post_type']   = 'post';
 		$_post_data['saveasdraft'] = true;
 
@@ -60,8 +60,8 @@
 
 		// Edit Draft Post for another user
-		$_post_data = array();
-		$_post_data['post_ID'] = self::factory()->post->create( array( 'post_author' => self::$editor_id ) );
+		$_post_data                = array();
+		$_post_data['post_ID']     = self::factory()->post->create( array( 'post_author' => self::$editor_id ) );
 		$_post_data['post_author'] = self::$editor_id;
-		$_post_data['post_type'] = 'post';
+		$_post_data['post_type']   = 'post';
 		$_post_data['post_status'] = 'draft';
 		$_post_data['saveasdraft'] = true;
@@ -77,7 +77,7 @@
 
 		// Create New Draft Post
-		$_post_data = array();
+		$_post_data                = array();
 		$_post_data['post_author'] = self::$editor_id;
-		$_post_data['post_type'] = 'post';
+		$_post_data['post_type']   = 'post';
 		$_post_data['saveasdraft'] = true;
 
@@ -88,8 +88,8 @@
 
 		// Publish Post
-		$_post_data = array();
+		$_post_data                = array();
 		$_post_data['post_author'] = self::$editor_id;
-		$_post_data['post_type'] = 'post';
-		$_post_data['publish'] = true;
+		$_post_data['post_type']   = 'post';
+		$_post_data['publish']     = true;
 
 		$_results = _wp_translate_postdata( false, $_post_data );
@@ -99,7 +99,7 @@
 
 		// Create New Draft Post for another user
-		$_post_data = array();
+		$_post_data                = array();
 		$_post_data['post_author'] = self::$contributor_id;
-		$_post_data['post_type'] = 'post';
+		$_post_data['post_type']   = 'post';
 		$_post_data['saveasdraft'] = true;
 
@@ -110,8 +110,8 @@
 
 		// Edit Draft Post for another user
-		$_post_data = array();
-		$_post_data['post_ID'] = self::factory()->post->create( array( 'post_author' => self::$contributor_id ) );
+		$_post_data                = array();
+		$_post_data['post_ID']     = self::factory()->post->create( array( 'post_author' => self::$contributor_id ) );
 		$_post_data['post_author'] = self::$contributor_id;
-		$_post_data['post_type'] = 'post';
+		$_post_data['post_type']   = 'post';
 		$_post_data['post_status'] = 'draft';
 		$_post_data['saveasdraft'] = true;
@@ -134,7 +134,7 @@
 		$post_data = array(
 			'post_title' => 'Post title',
-			'content' => 'Post content',
-			'post_type' => 'post',
-			'post_ID' => $post->ID,
+			'content'    => 'Post content',
+			'post_type'  => 'post',
+			'post_ID'    => $post->ID,
 		);
 		edit_post( $post_data );
@@ -149,17 +149,21 @@
 
 		register_taxonomy( 'wptests_tax', array( 'post' ) );
-		$t1 = self::factory()->term->create( array(
-			'taxonomy' => 'wptests_tax',
-			'name' => 'foo',
-			'slug' => 'bar',
-		) );
-		$t2 = self::factory()->term->create( array(
-			'taxonomy' => 'wptests_tax',
-			'name' => 'bar',
-			'slug' => 'foo',
-		) );
+		$t1 = self::factory()->term->create(
+			array(
+				'taxonomy' => 'wptests_tax',
+				'name'     => 'foo',
+				'slug'     => 'bar',
+			)
+		);
+		$t2 = self::factory()->term->create(
+			array(
+				'taxonomy' => 'wptests_tax',
+				'name'     => 'bar',
+				'slug'     => 'foo',
+			)
+		);
 
 		$post_data = array(
-			'post_ID' => self::$post_id,
+			'post_ID'   => self::$post_id,
 			'tax_input' => array(
 				'wptests_tax' => 'foo,baz',
@@ -185,12 +189,14 @@
 
 		register_taxonomy( 'wptests_tax', array( 'post' ) );
-		self::factory()->term->create( array(
-			'taxonomy' => 'wptests_tax',
-			'name' => 'foo',
-			'slug' => 'bar',
-		) );
+		self::factory()->term->create(
+			array(
+				'taxonomy' => 'wptests_tax',
+				'name'     => 'foo',
+				'slug'     => 'bar',
+			)
+		);
 
 		$post_data = array(
-			'post_ID' => self::$post_id,
+			'post_ID'   => self::$post_id,
 			'tax_input' => array(
 				'wptests_tax' => ' ',
@@ -211,25 +217,29 @@
 		wp_set_current_user( self::$admin_id );
 
-		$post1 = self::factory()->post->create( array(
-			'post_author'    => self::$author_ids[0],
-			'comment_status' => 'open',
-			'ping_status'    => 'open',
-			'post_status'    => 'publish',
-		) );
-
-		$post2 = self::factory()->post->create( array(
-			'post_author'    => self::$author_ids[1],
-			'comment_status' => 'closed',
-			'ping_status'    => 'closed',
-			'post_status'    => 'draft',
-		) );
+		$post1 = self::factory()->post->create(
+			array(
+				'post_author'    => self::$author_ids[0],
+				'comment_status' => 'open',
+				'ping_status'    => 'open',
+				'post_status'    => 'publish',
+			)
+		);
+
+		$post2 = self::factory()->post->create(
+			array(
+				'post_author'    => self::$author_ids[1],
+				'comment_status' => 'closed',
+				'ping_status'    => 'closed',
+				'post_status'    => 'draft',
+			)
+		);
 
 		$request = array(
-			'post_type'        => 'post',
-			'post_author'      => -1,
-			'ping_status'      => -1,
-			'comment_status'   => -1,
-			'_status'          => -1,
-			'post'             => array( $post1, $post2 ),
+			'post_type'      => 'post',
+			'post_author'    => -1,
+			'ping_status'    => -1,
+			'comment_status' => -1,
+			'_status'        => -1,
+			'post'           => array( $post1, $post2 ),
 		);
 
@@ -312,7 +322,13 @@
 
 		$future_date = date( 'Y-m-d H:i:s', time() + 100 );
-		$p = self::factory()->post->create( array( 'post_status' => 'future', 'post_name' => 'foo', 'post_date' => $future_date ) );
-
-		$found = get_sample_permalink( $p );
+		$p           = self::factory()->post->create(
+			array(
+				'post_status' => 'future',
+				'post_name'   => 'foo',
+				'post_date'   => $future_date,
+			)
+		);
+
+		$found    = get_sample_permalink( $p );
 		$expected = trailingslashit( home_url( $permalink_structure ) );
 
@@ -328,5 +344,11 @@
 
 		$future_date = date( 'Y-m-d H:i:s', time() + 100 );
-		$p = self::factory()->post->create( array( 'post_status' => 'future', 'post_name' => 'foo', 'post_date' => $future_date ) );
+		$p           = self::factory()->post->create(
+			array(
+				'post_status' => 'future',
+				'post_name'   => 'foo',
+				'post_date'   => $future_date,
+			)
+		);
 
 		$found = get_sample_permalink_html( $p );
@@ -345,9 +367,15 @@
 
 		$future_date = date( 'Y-m-d H:i:s', time() + 100 );
-		$p = self::factory()->post->create( array( 'post_status' => 'future', 'post_name' => 'foo-صورة', 'post_date' => $future_date ) );
+		$p           = self::factory()->post->create(
+			array(
+				'post_status' => 'future',
+				'post_name'   => 'foo-صورة',
+				'post_date'   => $future_date,
+			)
+		);
 
 		$found = get_sample_permalink_html( $p );
-		$post = get_post( $p );
-		$this->assertContains( 'href="' . get_option( 'home' ) . "/" . $post->post_name . '/"', $found );
+		$post  = get_post( $p );
+		$this->assertContains( 'href="' . get_option( 'home' ) . '/' . $post->post_name . '/"', $found );
 		$this->assertContains( '>' . urldecode( $post->post_name ) . '<', $found );
 	}
@@ -361,14 +389,16 @@
 		wp_set_current_user( self::$admin_id );
 
-		$p = self::factory()->attachment->create_object( 'صورة.jpg', 0, array(
-			'post_mime_type' => 'image/jpeg',
-			'post_type'      => 'attachment',
-			'post_title'     => 'صورة',
-			'post_status'    => 'inherit',
-		) );
+		$p = self::factory()->attachment->create_object(
+			'صورة.jpg', 0, array(
+				'post_mime_type' => 'image/jpeg',
+				'post_type'      => 'attachment',
+				'post_title'     => 'صورة',
+				'post_status'    => 'inherit',
+			)
+		);
 
 		$found = get_sample_permalink_html( $p );
-		$post = get_post( $p );
-		$this->assertContains( 'href="' . get_option( 'home' ) . "/" . $post->post_name . '/"', $found );
+		$post  = get_post( $p );
+		$this->assertContains( 'href="' . get_option( 'home' ) . '/' . $post->post_name . '/"', $found );
 		$this->assertContains( '>' . urldecode( get_permalink( $post ) ) . '<', $found );
 	}
@@ -384,27 +414,43 @@
 
 		// Published posts should use published permalink
-		$p = self::factory()->post->create( array( 'post_status' => 'publish', 'post_name' => 'foo-صورة' ) );
-
-		$found = get_sample_permalink_html( $p, null, 'new_slug-صورة' );
-		$post = get_post( $p );
+		$p = self::factory()->post->create(
+			array(
+				'post_status' => 'publish',
+				'post_name'   => 'foo-صورة',
+			)
+		);
+
+		$found   = get_sample_permalink_html( $p, null, 'new_slug-صورة' );
+		$post    = get_post( $p );
 		$message = 'Published post';
-		$this->assertContains( 'href="' . get_option( 'home' ) . "/" . $post->post_name . '/"', $found, $message );
+		$this->assertContains( 'href="' . get_option( 'home' ) . '/' . $post->post_name . '/"', $found, $message );
 		$this->assertContains( '>new_slug-صورة<', $found, $message );
 
 		// Scheduled posts should use published permalink
 		$future_date = date( 'Y-m-d H:i:s', time() + 100 );
-		$p = self::factory()->post->create( array( 'post_status' => 'future', 'post_name' => 'bar-صورة', 'post_date' => $future_date ) );
-
-		$found = get_sample_permalink_html( $p, null, 'new_slug-صورة' );
-		$post = get_post( $p );
+		$p           = self::factory()->post->create(
+			array(
+				'post_status' => 'future',
+				'post_name'   => 'bar-صورة',
+				'post_date'   => $future_date,
+			)
+		);
+
+		$found   = get_sample_permalink_html( $p, null, 'new_slug-صورة' );
+		$post    = get_post( $p );
 		$message = 'Scheduled post';
-		$this->assertContains( 'href="' . get_option( 'home' ) . "/" . $post->post_name . '/"', $found, $message );
+		$this->assertContains( 'href="' . get_option( 'home' ) . '/' . $post->post_name . '/"', $found, $message );
 		$this->assertContains( '>new_slug-صورة<', $found, $message );
 
 		// Draft posts should use preview link
-		$p = self::factory()->post->create( array( 'post_status' => 'draft', 'post_name' => 'baz-صورة' ) );
-
-		$found = get_sample_permalink_html( $p, null, 'new_slug-صورة' );
-		$post = get_post( $p );
+		$p = self::factory()->post->create(
+			array(
+				'post_status' => 'draft',
+				'post_name'   => 'baz-صورة',
+			)
+		);
+
+		$found   = get_sample_permalink_html( $p, null, 'new_slug-صورة' );
+		$post    = get_post( $p );
 		$message = 'Draft post';
 
@@ -426,8 +472,14 @@
 
 		$future_date = date( 'Y-m-d H:i:s', time() + 100 );
-		$p = self::factory()->post->create( array( 'post_status' => 'pending', 'post_name' => '', 'post_date' => $future_date ) );
+		$p           = self::factory()->post->create(
+			array(
+				'post_status' => 'pending',
+				'post_name'   => '',
+				'post_date'   => $future_date,
+			)
+		);
 
 		$found = get_sample_permalink_html( $p );
-		$post = get_post( $p );
+		$post  = get_post( $p );
 		$this->assertContains( 'href="' . esc_url( get_preview_post_link( $post ) ), $found );
 	}
@@ -439,7 +491,9 @@
 		$this->set_permalink_structure( '/%postname%/' );
 
-		$p = self::factory()->post->create( array(
-			'post_name' => '2015',
-		) );
+		$p = self::factory()->post->create(
+			array(
+				'post_name' => '2015',
+			)
+		);
 
 		$found = get_sample_permalink( $p );
@@ -453,7 +507,9 @@
 		$this->set_permalink_structure( '/%year%/%postname%/' );
 
-		$p = self::factory()->post->create( array(
-			'post_name' => '2015',
-		) );
+		$p = self::factory()->post->create(
+			array(
+				'post_name' => '2015',
+			)
+		);
 
 		$found = get_sample_permalink( $p );
@@ -467,7 +523,9 @@
 		$this->set_permalink_structure( '/%year%/%postname%/' );
 
-		$p = self::factory()->post->create( array(
-			'post_name' => '11',
-		) );
+		$p = self::factory()->post->create(
+			array(
+				'post_name' => '11',
+			)
+		);
 
 		$found = get_sample_permalink( $p );
@@ -481,7 +539,9 @@
 		$this->set_permalink_structure( '/%year%/%postname%/' );
 
-		$p = self::factory()->post->create( array(
-			'post_name' => '13',
-		) );
+		$p = self::factory()->post->create(
+			array(
+				'post_name' => '13',
+			)
+		);
 
 		$found = get_sample_permalink( $p );
@@ -495,7 +555,9 @@
 		$this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' );
 
-		$p = self::factory()->post->create( array(
-			'post_name' => '30',
-		) );
+		$p = self::factory()->post->create(
+			array(
+				'post_name' => '30',
+			)
+		);
 
 		$found = get_sample_permalink( $p );
@@ -509,11 +571,15 @@
 		$this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' );
 
-		self::factory()->post->create( array(
-			'post_name' => '30-2',
-		) );
-
-		$p = self::factory()->post->create( array(
-			'post_name' => '30',
-		) );
+		self::factory()->post->create(
+			array(
+				'post_name' => '30-2',
+			)
+		);
+
+		$p = self::factory()->post->create(
+			array(
+				'post_name' => '30',
+			)
+		);
 
 		$found = get_sample_permalink( $p );
@@ -527,7 +593,9 @@
 		$this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' );
 
-		$p = self::factory()->post->create( array(
-			'post_name' => '32',
-		) );
+		$p = self::factory()->post->create(
+			array(
+				'post_name' => '32',
+			)
+		);
 
 		$found = get_sample_permalink( $p );
@@ -541,7 +609,9 @@
 		$this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
 
-		$p = self::factory()->post->create( array(
-			'post_name' => '30',
-		) );
+		$p = self::factory()->post->create(
+			array(
+				'post_name' => '30',
+			)
+		);
 
 		$found = get_sample_permalink( $p );
@@ -555,15 +625,19 @@
 		$this->set_permalink_structure( '/%postname%/' );
 
-		$parent = self::factory()->post->create( array(
-			'post_type'  => 'page',
-			'post_title' => 'Parent Page',
-		) );
-
-		$child = self::factory()->post->create( array(
-			'post_type'   => 'page',
-			'post_title'  => 'Child Page',
-			'post_parent' => $parent,
-			'post_status' => 'draft',
-		) );
+		$parent = self::factory()->post->create(
+			array(
+				'post_type'  => 'page',
+				'post_title' => 'Parent Page',
+			)
+		);
+
+		$child = self::factory()->post->create(
+			array(
+				'post_type'   => 'page',
+				'post_title'  => 'Child Page',
+				'post_parent' => $parent,
+				'post_status' => 'draft',
+			)
+		);
 
 		$actual = get_sample_permalink( $child );
@@ -573,7 +647,9 @@
 
 	public function test_post_exists_should_match_title() {
-		$p = self::factory()->post->create( array(
-			'post_title' => 'Foo Bar',
-		) );
+		$p = self::factory()->post->create(
+			array(
+				'post_title' => 'Foo Bar',
+			)
+		);
 
 		$this->assertSame( $p, post_exists( 'Foo Bar' ) );
@@ -581,7 +657,9 @@
 
 	public function test_post_exists_should_not_match_nonexistent_title() {
-		$p = self::factory()->post->create( array(
-			'post_title' => 'Foo Bar',
-		) );
+		$p = self::factory()->post->create(
+			array(
+				'post_title' => 'Foo Bar',
+			)
+		);
 
 		$this->assertSame( 0, post_exists( 'Foo Bar Baz' ) );
@@ -589,10 +667,12 @@
 
 	public function test_post_exists_should_match_nonempty_content() {
-		$title = 'Foo Bar';
+		$title   = 'Foo Bar';
 		$content = 'Foo Bar Baz';
-		$p = self::factory()->post->create( array(
-			'post_title' => $title,
-			'post_content' => $content,
-		) );
+		$p       = self::factory()->post->create(
+			array(
+				'post_title'   => $title,
+				'post_content' => $content,
+			)
+		);
 
 		$this->assertSame( $p, post_exists( $title, $content ) );
@@ -603,10 +683,12 @@
 	 */
 	public function test_post_exists_should_match_content_with_no_title() {
-		$title = '';
+		$title   = '';
 		$content = 'Foo Bar Baz';
-		$p = self::factory()->post->create( array(
-			'post_title' => $title,
-			'post_content' => $content,
-		) );
+		$p       = self::factory()->post->create(
+			array(
+				'post_title'   => $title,
+				'post_content' => $content,
+			)
+		);
 
 		$this->assertSame( $p, post_exists( $title, $content ) );
@@ -614,10 +696,12 @@
 
 	public function test_post_exists_should_not_match_when_nonempty_content_doesnt_match() {
-		$title = 'Foo Bar';
+		$title   = 'Foo Bar';
 		$content = 'Foo Bar Baz';
-		$p = self::factory()->post->create( array(
-			'post_title' => $title,
-			'post_content' => $content . ' Quz',
-		) );
+		$p       = self::factory()->post->create(
+			array(
+				'post_title'   => $title,
+				'post_content' => $content . ' Quz',
+			)
+		);
 
 		$this->assertSame( 0, post_exists( $title, $content ) );
@@ -626,9 +710,11 @@
 	public function test_post_exists_should_match_nonempty_date() {
 		$title = 'Foo Bar';
-		$date = '2014-05-08 12:00:00';
-		$p = self::factory()->post->create( array(
-			'post_title' => $title,
-			'post_date' => $date,
-		) );
+		$date  = '2014-05-08 12:00:00';
+		$p     = self::factory()->post->create(
+			array(
+				'post_title' => $title,
+				'post_date'  => $date,
+			)
+		);
 
 		$this->assertSame( $p, post_exists( $title, '', $date ) );
@@ -637,9 +723,11 @@
 	public function test_post_exists_should_not_match_when_nonempty_date_doesnt_match() {
 		$title = 'Foo Bar';
-		$date = '2014-05-08 12:00:00';
-		$p = self::factory()->post->create( array(
-			'post_title' => $title,
-			'post_date' => '2015-10-10 00:00:00',
-		) );
+		$date  = '2014-05-08 12:00:00';
+		$p     = self::factory()->post->create(
+			array(
+				'post_title' => $title,
+				'post_date'  => '2015-10-10 00:00:00',
+			)
+		);
 
 		$this->assertSame( 0, post_exists( $title, '', $date ) );
@@ -647,12 +735,14 @@
 
 	public function test_post_exists_should_match_nonempty_title_content_and_date() {
-		$title = 'Foo Bar';
+		$title   = 'Foo Bar';
 		$content = 'Foo Bar Baz';
-		$date = '2014-05-08 12:00:00';
-		$p = self::factory()->post->create( array(
-			'post_title' => $title,
-			'post_content' => $content,
-			'post_date' => $date,
-		) );
+		$date    = '2014-05-08 12:00:00';
+		$p       = self::factory()->post->create(
+			array(
+				'post_title'   => $title,
+				'post_content' => $content,
+				'post_date'    => $date,
+			)
+		);
 
 		$this->assertSame( $p, post_exists( $title, $content, $date ) );
