diff --git a/tests/phpunit/tests/general/getTheGenerator.php b/tests/phpunit/tests/general/getTheGenerator.php
new file mode 100644
index 0000000000000..62100e9d1b2b7
--- /dev/null
+++ b/tests/phpunit/tests/general/getTheGenerator.php
@@ -0,0 +1,171 @@
+assertSame( sprintf( $expected, $version ), get_the_generator( $type ) );
+ }
+
+ /**
+ * Data provider for test_get_the_generator_types().
+ *
+ * @return array[]
+ */
+ public static function data_generator_types() {
+ return array(
+ 'html' => array(
+ 'html',
+ '',
+ ),
+ 'xhtml' => array(
+ 'xhtml',
+ '',
+ ),
+ 'atom' => array(
+ 'atom',
+ 'WordPress',
+ ),
+ 'rss2' => array(
+ 'rss2',
+ 'https://wordpress.org/?v=%s',
+ ),
+ 'rdf' => array(
+ 'rdf',
+ '',
+ ),
+ 'comment' => array(
+ 'comment',
+ '',
+ ),
+ );
+ }
+
+ /**
+ * Tests get_the_generator( 'export' ) formats export comment markup.
+ *
+ * @ticket 65819
+ */
+ public function test_get_the_generator_export() {
+ $output = get_the_generator( 'export' );
+ $version = get_bloginfo_rss( 'version' );
+
+ $this->assertMatchesRegularExpression(
+ '/^$/',
+ $output
+ );
+ }
+
+ /**
+ * Tests that get_the_generator() returns null when $type is empty and no action hook is active.
+ *
+ * @ticket 65819
+ */
+ public function test_get_the_generator_returns_null_when_type_empty() {
+ $this->assertNull( get_the_generator() );
+ $this->assertNull( get_the_generator( '' ) );
+ }
+
+ /**
+ * Tests that get_the_generator_$type filter modifies the generator markup.
+ *
+ * @ticket 65819
+ */
+ public function test_get_the_generator_filter() {
+ add_filter(
+ 'get_the_generator_xhtml',
+ static function ( $gen, $type ) {
+ return '';
+ },
+ 10,
+ 2
+ );
+
+ $this->assertSame( '', get_the_generator( 'xhtml' ) );
+ }
+
+ /**
+ * Tests that the_generator() echoes generator markup with a newline.
+ *
+ * @ticket 65819
+ */
+ public function test_the_generator_echoes_with_newline() {
+ $expected = get_the_generator( 'xhtml' ) . "\n";
+
+ $this->expectOutputString( $expected );
+ the_generator( 'xhtml' );
+ }
+
+ /**
+ * Tests that the the_generator filter modifies the displayed generator markup.
+ *
+ * @ticket 65819
+ */
+ public function test_the_generator_filter() {
+ add_filter(
+ 'the_generator',
+ static function ( $generator, $type ) {
+ return '';
+ },
+ 10,
+ 2
+ );
+
+ $this->expectOutputString( "\n" );
+ the_generator( 'html' );
+ }
+
+ /**
+ * Tests that wp_generator() displays the XHTML generator.
+ *
+ * @ticket 65819
+ */
+ public function test_wp_generator_displays_xhtml_generator() {
+ $expected = get_the_generator( 'xhtml' ) . "\n";
+
+ $this->expectOutputString( $expected );
+ wp_generator();
+ }
+
+ /**
+ * Tests that the wp_generator_type filter changes the generator type used by wp_generator().
+ *
+ * @ticket 65819
+ */
+ public function test_wp_generator_type_filter() {
+ add_filter(
+ 'wp_generator_type',
+ static function () {
+ return 'html';
+ }
+ );
+
+ $expected = get_the_generator( 'html' ) . "\n";
+
+ $this->expectOutputString( $expected );
+ wp_generator();
+ }
+}