FIX Allow tests to handle extra field labels being added in global state

This commit is contained in:
Robbie Averill 2018-06-13 09:59:23 +12:00
parent 06acad661f
commit eca3ac0e94
No known key found for this signature in database
GPG Key ID: 3C73047F9933CBEE

View File

@ -607,7 +607,10 @@ class CommentsTest extends FunctionalTest
{ {
$locale = i18n::get_locale(); $locale = i18n::get_locale();
i18n::set_locale('fr'); i18n::set_locale('fr');
/** @var Comment $comment */
$comment = $this->objFromFixture(Comment::class, 'firstComA'); $comment = $this->objFromFixture(Comment::class, 'firstComA');
$labels = $comment->FieldLabels(); $labels = $comment->FieldLabels();
$expected = array( $expected = array(
'Name' => 'Nom de l\'Auteur', 'Name' => 'Nom de l\'Auteur',
@ -627,7 +630,10 @@ class CommentsTest extends FunctionalTest
'Parent' => 'Parent' 'Parent' => 'Parent'
); );
i18n::set_locale($locale); i18n::set_locale($locale);
$this->assertEquals($expected, $labels); foreach ($expected as $key => $value) {
$this->assertEquals($value, $labels[$key]);
}
$labels = $comment->FieldLabels(); $labels = $comment->FieldLabels();
$expected = array( $expected = array(
'Name' => 'Author Name', 'Name' => 'Author Name',
@ -646,7 +652,9 @@ class CommentsTest extends FunctionalTest
'Created' => 'Date posted', 'Created' => 'Date posted',
'Parent' => 'Parent' 'Parent' => 'Parent'
); );
$this->assertEquals($expected, $labels); foreach ($expected as $key => $value) {
$this->assertEquals($value, $labels[$key]);
}
} }
public function testGetParent() public function testGetParent()