Skip to content

Commit

Permalink
Merge pull request #1318 from WordPress-Coding-Standards/feature/719-…
Browse files Browse the repository at this point in the history
…improve-function-call-detection

WP.I18n: add additional unit test
  • Loading branch information
JDGrimes authored Mar 1, 2018
2 parents 62a24fd + 7bbaf49 commit 6426385
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions WordPress/Tests/WP/I18nUnitTest.1.inc
Original file line number Diff line number Diff line change
Expand Up @@ -164,5 +164,12 @@ __( 'String default text domain.' ); // Ok because default domain is 'default' a
$mo->translate( $string ); // OK, not a function, but a method call.
Something\esc_html_e( $string ); // OK, not the WP function, but namespaced function call.

// Issue #719.
class Foo {
public function translate( $key ) {
return '';
}
}

// @codingStandardsChangeSetting WordPress.WP.I18n text_domain false
// @codingStandardsChangeSetting WordPress.WP.I18n check_translator_comments true
7 changes: 7 additions & 0 deletions WordPress/Tests/WP/I18nUnitTest.1.inc.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -164,5 +164,12 @@ __( 'String default text domain.' ); // Ok because default domain is 'default' a
$mo->translate( $string ); // OK, not a function, but a method call.
Something\esc_html_e( $string ); // OK, not the WP function, but namespaced function call.

// Issue #719.
class Foo {
public function translate( $key ) {
return '';
}
}

// @codingStandardsChangeSetting WordPress.WP.I18n text_domain false
// @codingStandardsChangeSetting WordPress.WP.I18n check_translator_comments true

0 comments on commit 6426385

Please sign in to comment.