diff --git a/tests/phpunit/tests/post.php b/tests/phpunit/tests/post.php
index 7e1f6e8..a4c6822 100644
--- a/tests/phpunit/tests/post.php
+++ b/tests/phpunit/tests/post.php
@@ -439,6 +439,35 @@ class Tests_Post extends WP_UnitTestCase {
 	}
 
 	/**
+	 * @ticket 5305
+	 */
+	function test_permalink_without_title() {
+		// bug: permalink doesn't work if post title is empty
+		// might only fail if the post ID is greater than four characters
+
+		global $wp_rewrite;
+		$wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
+
+		$post = array(
+			'post_author' => $this->author_id,
+			'post_status' => 'publish',
+			'post_content' => rand_str(),
+			'post_title' => '',
+			'post_date' => '2007-10-31 06:15:00',
+		);
+
+		// insert a post and make sure the ID is ok
+		$id = $this->post_ids[] = wp_insert_post($post);
+
+		$plink = get_permalink($id);
+
+		// permalink should include the post ID at the end
+		$this->assertEquals(get_option('siteurl').'/2007/10/31/'.$id.'/', $plink);
+
+		$wp_rewrite->set_permalink_structure('');
+	}
+
+	/**
 	 * @ticket 21013
 	 */
 	function test_wp_unique_post_slug_with_non_latin_slugs() {
