Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[new_profile/sex] Remove strtolower() and force uppercase #8633

Merged
merged 2 commits into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions modules/new_profile/php/new_profile.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion modules/new_profile/test/new_profileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
8 changes: 4 additions & 4 deletions src/StudyEntities/Candidate/Sex.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ class Sex implements \JsonSerializable
public $value;

private const VALID_VALUES = array(
'male',
'female',
'other',
'Male',
'Female',
'Other',
);

/**
Expand Down Expand Up @@ -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);
}

/**
Expand Down