From a57c83c1211621685b136962f53cbaa8c708a881 Mon Sep 17 00:00:00 2001 From: Guy Marriott Date: Fri, 11 Jan 2019 12:22:31 +1300 Subject: [PATCH 1/2] Removing superflous i18n test and updating label test to only test labels specifically added --- tests/CommentsTest.php | 35 +---------------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/tests/CommentsTest.php b/tests/CommentsTest.php index a319a90..4ef6cda 100644 --- a/tests/CommentsTest.php +++ b/tests/CommentsTest.php @@ -605,52 +605,19 @@ class CommentsTest extends FunctionalTest */ public function testFieldLabels() { - $locale = i18n::get_locale(); - i18n::set_locale('fr'); - /** @var Comment $comment */ $comment = $this->objFromFixture(Comment::class, 'firstComA'); - $labels = $comment->FieldLabels(); - $expected = array( - 'Name' => 'Nom de l\'Auteur', - 'Comment' => 'Commentaire', - 'Email' => 'Email', - 'URL' => 'URL', - 'Moderated' => 'Modéré?', - 'IsSpam' => 'Spam?', - 'AllowHtml' => 'Allow Html', - 'SecretToken' => 'Secret Token', - 'Depth' => 'Depth', - 'Author' => 'Author Member', - 'ParentComment' => 'Parent Comment', - 'ChildComments' => 'Child Comments', - 'ParentTitle' => 'Parent', - 'Created' => 'Date de publication', - 'Parent' => 'Parent' - ); - i18n::set_locale($locale); - foreach ($expected as $key => $value) { - $this->assertEquals($value, $labels[$key]); - } - $labels = $comment->FieldLabels(); $expected = array( 'Name' => 'Author Name', 'Comment' => 'Comment', 'Email' => 'Email', 'URL' => 'URL', - 'Moderated' => 'Moderated?', 'IsSpam' => 'Spam?', - 'AllowHtml' => 'Allow Html', - 'SecretToken' => 'Secret Token', - 'Depth' => 'Depth', - 'Author' => 'Author Member', - 'ParentComment' => 'Parent Comment', - 'ChildComments' => 'Child Comments', + 'Moderated' => 'Moderated?', 'ParentTitle' => 'Parent', 'Created' => 'Date posted', - 'Parent' => 'Parent' ); foreach ($expected as $key => $value) { $this->assertEquals($value, $labels[$key]); From 7691237fe5854af04a2047ba538b2285733ebc3b Mon Sep 17 00:00:00 2001 From: Guy Marriott Date: Fri, 11 Jan 2019 12:25:20 +1300 Subject: [PATCH 2/2] FIX Correcting inconsistent capitalisation of label --- lang/en.yml | 2 +- src/Model/Comment.php | 2 +- tests/CommentsTest.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lang/en.yml b/lang/en.yml index 04eef78..82c7592 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -74,7 +74,7 @@ en: EMAIL: Email ISSPAM: 'Spam?' MODERATED: 'Moderated?' - NAME: 'Author Name' + NAME: 'Author name' 'ON': 'on' OPTIONS: Options OPTION_DESCRIPTION: 'Unmoderated and spam comments will not be displayed until approved' diff --git a/src/Model/Comment.php b/src/Model/Comment.php index 0dd6eec..faa2b17 100755 --- a/src/Model/Comment.php +++ b/src/Model/Comment.php @@ -219,7 +219,7 @@ class Comment extends DataObject { $labels = parent::fieldLabels($includerelations); - $labels['Name'] = _t(__CLASS__ . '.NAME', 'Author Name'); + $labels['Name'] = _t(__CLASS__ . '.NAME', 'Author name'); $labels['Comment'] = _t(__CLASS__ . '.COMMENT', 'Comment'); $labels['Email'] = _t(__CLASS__ . '.EMAIL', 'Email'); $labels['URL'] = _t(__CLASS__ . '.URL', 'URL'); diff --git a/tests/CommentsTest.php b/tests/CommentsTest.php index 4ef6cda..9f9836e 100644 --- a/tests/CommentsTest.php +++ b/tests/CommentsTest.php @@ -610,7 +610,7 @@ class CommentsTest extends FunctionalTest $labels = $comment->FieldLabels(); $expected = array( - 'Name' => 'Author Name', + 'Name' => 'Author name', 'Comment' => 'Comment', 'Email' => 'Email', 'URL' => 'URL',