Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CiviCRM Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
CiviCRM Core
Commits
c7759dc3
Unverified
Commit
c7759dc3
authored
3 years ago
by
DaveD
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #20459 from eileenmcnaughton/trigg
[Ref] Remove function parameter only used from test
parents
a076350b
753bc831
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CRM/Logging/Schema.php
+1
-7
1 addition, 7 deletions
CRM/Logging/Schema.php
tests/phpunit/api/v3/LoggingTest.php
+15
-5
15 additions, 5 deletions
tests/phpunit/api/v3/LoggingTest.php
with
16 additions
and
12 deletions
CRM/Logging/Schema.php
+
1
−
7
View file @
c7759dc3
...
...
@@ -518,10 +518,8 @@ AND (TABLE_NAME LIKE 'log_civicrm_%' $nonStandardTableNameString )
/**
* Fix schema differences.
*
* @param bool $rebuildTrigger
*/
public
function
fixSchemaDifferencesForAll
(
$rebuildTrigger
=
FALSE
)
{
public
function
fixSchemaDifferencesForAll
(
):
void
{
$diffs
=
[];
$this
->
resetTableColumnsCache
();
...
...
@@ -537,10 +535,6 @@ AND (TABLE_NAME LIKE 'log_civicrm_%' $nonStandardTableNameString )
foreach
(
$diffs
as
$table
=>
$cols
)
{
$this
->
fixSchemaDifferencesFor
(
$table
,
$cols
);
}
if
(
$rebuildTrigger
)
{
// invoke the meta trigger creation call
CRM_Core_DAO
::
triggerRebuild
(
NULL
,
TRUE
);
}
}
/**
...
...
This diff is collapsed.
Click to expand it.
tests/phpunit/api/v3/LoggingTest.php
+
15
−
5
View file @
c7759dc3
...
...
@@ -29,6 +29,10 @@ class api_v3_LoggingTest extends CiviUnitTestCase {
/**
* Clean up log tables.
*
* @throws \API_Exception
* @throws \CRM_Core_Exception
* @throws \CiviCRM_API3_Exception
*/
protected
function
tearDown
():
void
{
$this
->
quickCleanup
([
'civicrm_email'
,
'civicrm_address'
]);
...
...
@@ -41,8 +45,10 @@ class api_v3_LoggingTest extends CiviUnitTestCase {
/**
* Test that logging is successfully enabled and disabled.
*
* @throws \CRM_Core_Exception
*/
public
function
testEnableDisableLogging
()
{
public
function
testEnableDisableLogging
()
:
void
{
$this
->
assertEquals
(
0
,
$this
->
callAPISuccessGetValue
(
'Setting'
,
[
'name'
=>
'logging'
]));
$this
->
assertLoggingEnabled
(
FALSE
);
...
...
@@ -150,16 +156,20 @@ class api_v3_LoggingTest extends CiviUnitTestCase {
/**
* Check that if a field is added then the trigger is updated on refresh.
*
* @throws \CRM_Core_Exception
*/
public
function
testRebuildTriggerAfterSchemaChange
()
{
public
function
testRebuildTriggerAfterSchemaChange
()
:
void
{
$this
->
callAPISuccess
(
'Setting'
,
'create'
,
[
'logging'
=>
TRUE
]);
$tables
=
[
'civicrm_acl'
,
'civicrm_website'
];
foreach
(
$tables
as
$table
)
{
CRM_Core_DAO
::
executeQuery
(
"ALTER TABLE
$table
ADD column temp_col INT(10)"
);
}
unset
(
\Civi
::
$statics
[
'CRM_Logging_Schema'
]);
$schema
=
new
CRM_Logging_Schema
();
$schema
->
fixSchemaDifferencesForAll
(
TRUE
);
$schema
->
fixSchemaDifferencesForAll
();
Civi
::
service
(
'sql_triggers'
)
->
rebuild
();
foreach
(
$tables
as
$table
)
{
$this
->
assertTrue
(
$this
->
checkColumnExistsInTable
(
'log_'
.
$table
,
'temp_col'
),
'log_'
.
$table
.
' has temp_col'
);
...
...
@@ -168,8 +178,8 @@ class api_v3_LoggingTest extends CiviUnitTestCase {
$this
->
assertStringContainsString
(
'temp_col'
,
$dao
->
Statement
);
}
}
CRM_Core_DAO
::
executeQuery
(
"
ALTER TABLE civicrm_acl DROP column temp_col
"
);
CRM_Core_DAO
::
executeQuery
(
"
ALTER TABLE civicrm_website DROP column temp_col
"
);
CRM_Core_DAO
::
executeQuery
(
'
ALTER TABLE civicrm_acl DROP column temp_col
'
);
CRM_Core_DAO
::
executeQuery
(
'
ALTER TABLE civicrm_website DROP column temp_col
'
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment