diff --git a/tests/phpunit/tests/link/getAdjacentPostLink.php b/tests/phpunit/tests/link/getAdjacentPostLink.php
new file mode 100644
index 0000000000..f4ffc10095
--- /dev/null
+++ b/tests/phpunit/tests/link/getAdjacentPostLink.php
@@ -0,0 +1,61 @@
+cat_id = $this->factory->category->create( array( 'name' => 'other' ) );
+ $this->post_ids = array();
+ $this->post_ids[] = $this->factory->post->create( array( 'post_type' => 'post', 'post_date' => '2014-10-26 05:32:29', 'category_id' => 1 ) );
+ $this->post_ids[] = $this->factory->post->create( array( 'post_type' => 'post', 'post_date' => '2014-10-26 04:32:29', 'category_id' => $this->cat_id ) );
+ $this->post_ids[] = $this->factory->post->create( array( 'post_type' => 'post', 'post_date' => '2014-10-26 03:32:29', 'category_id' => 1 ) );
+ $this->post_ids[] = $this->factory->post->create( array( 'post_type' => 'post', 'post_date' => '2014-10-26 02:32:29', 'category_id' => $this->cat_id ) );
+ $this->post_ids[] = $this->factory->post->create( array( 'post_type' => 'post', 'post_date' => '2014-10-26 01:32:29', 'category_id' => 1 ) );
+
+ //set current post (has 2 on each end)
+ global $GLOBALS;
+ $GLOBALS['post'] = get_post( $this->post_ids[2] );
+ }
+
+ public function test_get_next_post_link_default() {
+ $actual = get_next_post_link();
+ $expected = 'Post title 2 »';
+ $this->assertSame( $expected, $actual );
+ }
+
+ public function test_get_previous_post_link_default() {
+ $actual = get_previous_post_link();
+ $expected = '« Post title 4';
+ $this->assertSame( $expected, $actual );
+ }
+
+ public function test_get_next_post_link_same_category() {
+ $actual = get_next_post_link( '%link »', '%title', true );
+ $expected = 'Post title 2 »';
+ $this->assertSame( $expected, $actual );
+ }
+
+ public function test_get_previous_post_link_same_category() {
+ $actual = get_previous_post_link( '« %link', '%title', true );
+ $expected = '« Post title 4';
+ $this->assertSame( $expected, $actual );
+ }
+
+ public function test_get_next_post_link_exclude_category() {
+ $actual = get_next_post_link( '%link »', '%title', false, $this->cat_id );
+ $expected = 'Post title 2 »';
+ $this->assertSame( $expected, $actual );
+ }
+
+ public function test_get_previous_post_link_exclude_category() {
+ $actual = get_previous_post_link( '« %link', '%title', false, $this->cat_id );
+ $expected = '« Post title 4';
+ $this->assertSame( $expected, $actual );
+ }
+}