diff --git a/tests/phpunit/tests/formatting/linksAddBaseUrl.php b/tests/phpunit/tests/formatting/linksAddBaseUrl.php
new file mode 100644
index 0000000000000..0d88cc061a564
--- /dev/null
+++ b/tests/phpunit/tests/formatting/linksAddBaseUrl.php
@@ -0,0 +1,94 @@
+assertSame( $expected, links_add_base_url( $content, $base, $attrs ) );
+ } else {
+ $this->assertSame( $expected, links_add_base_url( $content, $base ) );
+ }
+ }
+
+ /**
+ * Data provider for test_links_add_base_url().
+ *
+ * @return array[]
+ */
+ public function data_links_add_base_url() {
+ return array(
+ 'https' => array(
+ 'content' => '',
+ 'base' => 'https://localhost',
+ 'attrs' => null,
+ 'expected' => '',
+ ),
+ 'http' => array(
+ 'content' => '',
+ 'base' => 'http://localhost',
+ 'attrs' => null,
+ 'expected' => '',
+ ),
+ 'relative_scheme' => array(
+ 'content' => '',
+ 'base' => 'http://localhost',
+ 'attrs' => null,
+ 'expected' => '',
+ ),
+ 'empty_array' => array(
+ 'content' => '',
+ 'base' => 'https://localhost',
+ 'attrs' => array(),
+ 'expected' => '',
+ ),
+ 'data_url' => array(
+ 'content' => '',
+ 'base' => 'https://localhost',
+ 'attrs' => array( 'data-url', 'href' ),
+ 'expected' => '',
+ ),
+ 'not relative' => array(
+ 'content' => '',
+ 'base' => 'https://localbase',
+ 'attrs' => null,
+ 'expected' => '',
+ ),
+ 'no_href' => array(
+ 'content' => '',
+ 'base' => 'https://localhost',
+ 'attrs' => null,
+ 'expected' => '',
+ ),
+ 'img' => array(
+ 'content' => '',
+ 'base' => 'https://localhost',
+ 'attrs' => null,
+ 'expected' => '',
+ ),
+ 'ftp' => array(
+ 'content' => 'sss',
+ 'base' => 'ftp://localhost',
+ 'attrs' => null,
+ 'expected' => 'sss',
+ ),
+ 'ftps' => array(
+ 'content' => 'sss',
+ 'base' => 'ftps://localhost',
+ 'attrs' => null,
+ 'expected' => 'sss',
+ ),
+ );
+ }
+}