-
-
Notifications
You must be signed in to change notification settings - Fork 824
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
NFC - minor Cleanup in test class #24827
Conversation
(Standard links)
|
'street_address' => '1 Happy Place', | ||
'city' => 'Miami', | ||
'state_province' => 'Flordia', | ||
'state_province' => 'Florida', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose it could be interesting ("What happens when the state_province
is wonky?")... but it's clearly not the focus of the test...
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol yes
caface6
to
e74107f
Compare
$addFormat = '{contact.state_province}'; | ||
Civi::settings()->set('address_format', $addFormat); | ||
$formatted_address = CRM_Utils_Address::getFormattedBillingAddressFieldsFromParameters($params, '99'); | ||
$this->assertTrue((bool) $formatted_address == 'AL'); | ||
$this->assertEquals('AL', $formatted_address); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so there seems to be trailing new line that is showing up here somehow @eileenmcnaughton
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that's what formatted means...
And hence the previous code's (bool) to cast it true which then matched the string which autocasts to true so it always passed. How else do you deal with trailing newlines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@demeritcowboy so we could use that pattern to make all our tests pass....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or even simpler use the technique @mlutfy discovered: Automatic pass!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another winning technique
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e74107f
to
5a2fb6a
Compare
Jenkins re test this please |
Overview
NFC - minor Cleanup in test class
Before
After
Technical Details
Comments