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

[Ref] Remove function parameter only used from test #20459

Merged
merged 1 commit into from
Jun 1, 2021

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Jun 1, 2021

Overview

[Ref] Remove function parameter only used from test

Before

image

After

$rebuildTriggers parameter removed

Technical Details

The test passes a function parameter to rebuild triggers but the only other
call to this function in the civi-verse doesn't. We shouldn't make this function
more complex for just the test.

Comments

There could be some test caching issues that need re-solving - will see what jenkins says - as this was obviously at least in part there for that

@civibot
Copy link

civibot bot commented Jun 1, 2021

(Standard links)

@civibot civibot bot added the master label Jun 1, 2021
@eileenmcnaughton eileenmcnaughton changed the title Fix trigger rebuild to avoid deprecated function [Ref] Remove function parameter only used from test Jun 1, 2021
[Ref] Remove function parameter only used from test

The test passes a function parameter to rebuild triggers but the only other
call to this function in the civi-verse doesn't. We shouldn't make this function
more complex for just the test.

Note the function also uses the force param which I didn't move to the
test call - it's possible when the tests all run together I'll need
to force cache clearing but this seems like a dumb way

$schema = new CRM_Logging_Schema();
$schema->fixSchemaDifferencesForAll(TRUE);
$schema->fixSchemaDifferencesForAll();
Civi::service('sql_triggers')->rebuild();
Copy link
Member

Choose a reason for hiding this comment

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

I think the first run of the test failed because it needs rebuild($tables=NULL, $force=TRUE) to be equivalent to the previous call to triggerRebuild($tables=NULL, $force=TRUE); If that works, then +1 for merging.

Alternatively - you might be able to swap the two lines with just a call to $schema->fixSchemaDifferences() or $schema->fixSchemaDifferences(TRUE), since that function basically does these two lines.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah - I'm trying to get rid of that $force being passed in because I don't think we should be offering it as a parameter purely to support this test - might take a couple of rounds fight with jenkins to get there

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok - unsetting that static worked

@demeritcowboy demeritcowboy merged commit c7759dc into civicrm:master Jun 1, 2021
@eileenmcnaughton eileenmcnaughton deleted the trigg branch June 1, 2021 19:34
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.

3 participants