Skip to content

Commit

Permalink
5.50.alpha1.mysql.tpl - Escape grouping (reserved word in MySQL 8.0…
Browse files Browse the repository at this point in the history
….1+)

Import - also export invalid as export error

I found that rows that fail validation are marked 'invalid'
rather than error & won't show on the preview screen.

I guess I could check for invalid vs error separately
- gets kinda weird though - if you leave them
in the file you are importing surely they are still errors
to see on the summary screen even though
you knew they were invalid on the Preview?

(E2E) testErrorChrome - Skip Backdrop and D8+ (much like D7)

This test was added during 5.50.alpha (civicrm#23257, civicrm#22805).  It's purpose is to
assert that the page-chrome/site-wide-template is present on certain
error-messages; however, the underlying behavior was only implemented on
WordPress. It has not yet been implemented on other CMS.

Before
------

* __WordPress__: Runs testErrorChrome. Expected to pass.
* __Drupal 7__: Skip testErrorChrome (mostly) because it is expected to fail.
* __Drupal 8+, Backdrop__: Runs testErrorChrome. Fails.

After
-----

* __WordPress__: Runs testErrorChrome. Expected to pass.
* ___Drupal 7, Drupal 8+, Backdrop__: Skip testErrorChrome (mostly) because it is expected to fail.

Comment
-------

It still runs `testErrorChrome` for `permission` errors; per MM discussion, it appears that this does actually work, but we need
to tune assertion for BD+D8.

(E2E) `testErrorChrome` - Update to work with current wp-demo build

This test was added during 5.50.alpha (civicrm#23257, civicrm#22805).  It's purpose is to
assert that the page-chrome/site-wide-template is present.  It appears that
the markup from WordPress has changed slightly.  (It may be that I
originally tested against an older version of WP.) In any event, this
relaxes the test so that it also passes on a newer WP build.

(E2E) testErrorChrome - Revise page-chrome check for all Drupal-style UFs
  • Loading branch information
totten authored and darrick committed May 7, 2022
1 parent 5d27dcb commit 61f9df5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CRM/Import/DataSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ private function instantiateQueryObject(): void {
protected function getStatusMapping(): array {
return [
CRM_Import_Parser::VALID => ['imported', 'new'],
CRM_Import_Parser::ERROR => ['error'],
CRM_Import_Parser::ERROR => ['error', 'invalid'],
CRM_Import_Parser::DUPLICATE => ['duplicate'],
];
}
Expand Down
8 changes: 4 additions & 4 deletions CRM/Upgrade/Incremental/sql/5.50.alpha1.mysql.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,20 @@ INSERT IGNORE INTO `civicrm_state_province` (`country_id`, `abbreviation`, `name
SELECT @option_group_id_cgeo := max(id) FROM civicrm_option_group WHERE name = 'cg_extend_objects';

UPDATE civicrm_option_value
SET grouping = 'case_type_id', {localize field='description'}description = NULL{/localize}
SET `grouping` = 'case_type_id', {localize field='description'}description = NULL{/localize}
WHERE option_group_id = @option_group_id_cgeo AND value = 'Case';

SELECT @option_group_id_cdt := max(id) FROM civicrm_option_group WHERE name = 'custom_data_type';

UPDATE civicrm_option_value
SET {localize field='label'}label = '{ts escape="sql"}Participants (Role){/ts}'{/localize}, grouping = 'role_id'
SET {localize field='label'}label = '{ts escape="sql"}Participants (Role){/ts}'{/localize}, `grouping` = 'role_id'
WHERE option_group_id = @option_group_id_cdt AND name = 'ParticipantRole';

UPDATE civicrm_option_value
SET {localize field='label'}label = '{ts escape="sql"}Participants (Event Name){/ts}'{/localize}, grouping = 'event_id'
SET {localize field='label'}label = '{ts escape="sql"}Participants (Event Name){/ts}'{/localize}, `grouping` = 'event_id'
WHERE option_group_id = @option_group_id_cdt AND name = 'ParticipantEventName';

UPDATE civicrm_option_value
SET {localize field='label'}label = '{ts escape="sql"}Participants (Event Type){/ts}'{/localize}, grouping = 'event_id.event_type_id'
SET {localize field='label'}label = '{ts escape="sql"}Participants (Event Type){/ts}'{/localize}, `grouping` = 'event_id.event_type_id'
WHERE option_group_id = @option_group_id_cdt AND name = 'ParticipantEventType';

10 changes: 6 additions & 4 deletions tests/phpunit/E2E/Core/ErrorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class ErrorTest extends \CiviEndToEndTestCase {
// Format: "{$uf}_{$testFunc}_{$errorType}"
'/WordPress_testErrorStatus_(fatal|exception)/',
'/Drupal_testErrorChrome_(fatal|exception)/',
'/Drupal8_testErrorChrome_(fatal|exception)/',
'/Backdrop_testErrorChrome_(fatal|exception)/',
];

public function getErrorTypes() {
Expand Down Expand Up @@ -94,10 +96,10 @@ public function testErrorStatus(string $url, string $errorType) {
public function testErrorChrome(string $url, string $errorType) {
$this->skipIfNonCompliant(__FUNCTION__, $errorType);
$patterns = [
'Backdrop' => '/body class=\".*not-logged-in/',
'Drupal' => '/body class=\".*not-logged-in/',
'Drupal8' => '/body class=\".*not-logged-in/',
'WordPress' => '/ role=.navigation./',
'Backdrop' => '/href=.*user\/(login|register)/',
'Drupal' => '/href=.*user\/register/',
'Drupal8' => '/href=.*user\/(login|register)/',
'WordPress' => '/( role=.navigation.| class=.site-header.)/',
];
if (!isset($patterns[CIVICRM_UF])) {
$this->markTestIncomplete('testErrorChrome() cannot check for chrome on ' . CIVICRM_UF);
Expand Down

0 comments on commit 61f9df5

Please sign in to comment.