Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/wp-content/plugins/hello.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function hello_dolly() {

printf(
'<p id="dolly"><span class="screen-reader-text">%s </span><span dir="ltr"%s>%s</span></p>',
__( 'Quote from Hello Dolly song, by Jerry Herman:' ),
__( 'Quote from Hello Dolly song, by Jerry Herman:', 'hello-dolly' ),
$lang,
$chosen
);
Expand Down
36 changes: 36 additions & 0 deletions tests/phpunit/tests/plugins/helloDolly.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

/**
* Tests for the Hello Dolly bundled plugin.
*
* @group plugins
*
* @covers ::hello_dolly
*/
class Tests_Plugins_HelloDolly extends WP_UnitTestCase {

/**
* Tests that hello_dolly() uses the 'hello-dolly' text domain.
*
* @ticket 65676
*/
public function test_hello_dolly_uses_hello_dolly_textdomain() {
require_once ABSPATH . 'wp-content/plugins/hello.php';

$passed_domain = null;
$filter = function ( $translation, $text, $domain ) use ( &$passed_domain ) {
if ( 'Quote from Hello Dolly song, by Jerry Herman:' === $text ) {
$passed_domain = $domain;
}
return $translation;
};

add_filter( 'gettext', $filter, 10, 3 );
ob_start();
hello_dolly();
ob_end_clean();
remove_filter( 'gettext', $filter, 10 );

$this->assertSame( 'hello-dolly', $passed_domain );
}
}
Loading