From 42b49b71e838a14475783ee1b806b43400d0a81e Mon Sep 17 00:00:00 2001 From: Rida Abou-Haidar Date: Thu, 13 Apr 2023 22:22:40 -0400 Subject: [PATCH 1/2] [new_profile/sex] Remove strtolower and force uppercase --- modules/new_profile/php/new_profile.class.inc | 6 +++--- src/StudyEntities/Candidate/Sex.php | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/new_profile/php/new_profile.class.inc b/modules/new_profile/php/new_profile.class.inc index 5ef390d3d42..20324a96818 100644 --- a/modules/new_profile/php/new_profile.class.inc +++ b/modules/new_profile/php/new_profile.class.inc @@ -142,9 +142,9 @@ class New_Profile extends \NDB_Form $dobFormat = $config->getSetting('dobFormat'); $edc = $config->getSetting('useEDC'); $sex = [ - 'male' => 'Male', - 'female' => 'Female', - 'other' => 'Other', + 'Male' => 'Male', + 'Female' => 'Female', + 'Other' => 'Other', ]; $pscidSet = "false"; $minYear = (isset($startYear, $ageMax)) ? $startYear - $ageMax : null; diff --git a/src/StudyEntities/Candidate/Sex.php b/src/StudyEntities/Candidate/Sex.php index 65f31422780..f7f3481af2d 100644 --- a/src/StudyEntities/Candidate/Sex.php +++ b/src/StudyEntities/Candidate/Sex.php @@ -29,9 +29,9 @@ class Sex implements \JsonSerializable public $value; private const VALID_VALUES = array( - 'male', - 'female', - 'other', + 'Male', + 'Female', + 'Other', ); /** @@ -61,7 +61,7 @@ public function __construct(string $value) */ public static function validate(string $value): bool { - return in_array(strtolower($value), self::VALID_VALUES, true); + return in_array($value, self::VALID_VALUES, true); } /** From ca86829605069be93c6251d544382a269d68db0d Mon Sep 17 00:00:00 2001 From: Rida Abou-Haidar Date: Sat, 15 Apr 2023 11:12:05 -0400 Subject: [PATCH 2/2] Update new_profileTest.php --- modules/new_profile/test/new_profileTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/new_profile/test/new_profileTest.php b/modules/new_profile/test/new_profileTest.php index 282090f97da..b4de2785b17 100644 --- a/modules/new_profile/test/new_profileTest.php +++ b/modules/new_profile/test/new_profileTest.php @@ -77,7 +77,7 @@ function testNewProfileCreateCandidate(): void // send a key to sex $sexElement = $this->safeFindElement(WebDriverBy::Name('sex')); $sexOption = new WebDriverSelect($sexElement); - $sexOption->selectByValue("male"); + $sexOption->selectByValue("Male"); $sexElement = $this->safeFindElement(WebDriverBy::Name('site')); $sexOption = new WebDriverSelect($sexElement); $sexOption->selectByValue("1");