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

Strictness cleanups in test class #26005

Merged
merged 1 commit into from
Apr 5, 2023

Conversation

eileenmcnaughton
Copy link
Contributor

Overview

Strictness cleanups in test class

Before

In strict mode we see

image

After

I removed the sha bit - that randomisation is just a work-around for sloppy cleanup anyway - if the cleanup is done between tests we don't need to randomise

Technical Details

Various other minor cleanups

Comments

@civibot
Copy link

civibot bot commented Apr 4, 2023

(Standard links)

@civibot civibot bot added the master label Apr 4, 2023
$expected = trim((preg_replace('/[ \r\n\t]+/', ' ', $expected)));
$actual = trim((preg_replace('/[ \r\n\t]+/', ' ', $actual)));
$this->assertEquals($expected, $actual, $message);
public function assertLike(string $expectedSQL, string $actualSQL, string $message = '') {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm IDE made params the same as parent - do these just duplicate parent?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep - fn can go

* @param $actual
* @param string $message
*/
public function assertLike($expected, $actual, $message = '') {
Copy link
Contributor Author

@eileenmcnaughton eileenmcnaughton Apr 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

turns out to be in parent 5.15 release notes seem to indicate there was some consolidation of it then

@@ -2547,12 +2548,10 @@ protected function eventPriceSetCreate($feeTotal, $minAmt = 0, string $type = 'T
}
$priceFieldID = $this->callAPISuccess('PriceField', 'create', $paramsField)['id'];
$this->ids['PriceField']['event_' . strtolower($type)] = $priceFieldID;
$this->_ids['price_field'] = [$priceFieldID];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might cause test fails - but it is extraneous so I will fix the tests if so. PHP 8 wouldn't like this

@eileenmcnaughton eileenmcnaughton force-pushed the strict_test branch 5 times, most recently from 4188615 to b4abbb8 Compare April 5, 2023 03:06
@colemanw colemanw merged commit ae56ff2 into civicrm:master Apr 5, 2023
@colemanw colemanw deleted the strict_test branch April 5, 2023 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants