-
-
Notifications
You must be signed in to change notification settings - Fork 825
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
dev/core#3498 Fix mishandled option values #23736
Merged
eileenmcnaughton
merged 3 commits into
civicrm:master
from
eileenmcnaughton:import_multi
Jun 9, 2022
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?php | ||
/** | ||
* @file | ||
* File for the CRM_Custom_Import_Parser_ContributionTest class. | ||
*/ | ||
|
||
/** | ||
* Test Contribution import parser. | ||
* | ||
* @package CiviCRM | ||
* @group headless | ||
*/ | ||
class CRM_Custom_Import_Parser_ApiTest extends CiviUnitTestCase { | ||
|
||
use CRMTraits_Custom_CustomDataTrait; | ||
use CRMTraits_Import_ParserTrait; | ||
|
||
/** | ||
* Test the full form-flow import. | ||
*/ | ||
public function testImport(): void { | ||
$this->individualCreate(); | ||
$this->createCustomGroupWithFieldOfType(['is_multiple' => TRUE, 'extends' => 'Contact'], 'select', 'level'); | ||
$customGroupID = $this->ids['CustomGroup']['level']; | ||
$dateFieldID = $this->createDateCustomField(['date_format' => 'yy', 'custom_group_id' => $customGroupID])['id']; | ||
$this->importCSV('custom_data_date_select.csv', [ | ||
['name' => 'contact_id'], | ||
['name' => $this->getCustomFieldName('levelselect')], | ||
['name' => 'do_not_import'], | ||
['name' => 'custom_' . $dateFieldID], | ||
], ['multipleCustomData' => $customGroupID]); | ||
$dataSource = new CRM_Import_DataSource_CSV($this->userJobID); | ||
$row = $dataSource->getRow(); | ||
$this->assertEquals('IMPORTED', $row['_status']); | ||
$row = $dataSource->getRow(); | ||
$this->assertEquals('IMPORTED', $row['_status']); | ||
$row = $dataSource->getRow(); | ||
$this->assertEquals('ERROR', $row['_status']); | ||
} | ||
|
||
/** | ||
* Get the import's datasource form. | ||
* | ||
* Defaults to contribution - other classes should override. | ||
* | ||
* @param array $submittedValues | ||
* | ||
* @return \CRM_Custom_Import_Form_DataSource | ||
* @noinspection PhpUnnecessaryLocalVariableInspection | ||
*/ | ||
protected function getDataSourceForm(array $submittedValues): CRM_Custom_Import_Form_DataSource { | ||
/* @var \CRM_Custom_Import_Form_DataSource $form */ | ||
$form = $this->getFormObject('CRM_Custom_Import_Form_DataSource', $submittedValues); | ||
return $form; | ||
} | ||
|
||
/** | ||
* Get the import's mapField form. | ||
* | ||
* Defaults to contribution - other classes should override. | ||
* | ||
* @param array $submittedValues | ||
* | ||
* @return \CRM_Custom_Import_Form_MapField | ||
* @noinspection PhpUnnecessaryLocalVariableInspection | ||
*/ | ||
protected function getMapFieldForm(array $submittedValues): CRM_Custom_Import_Form_MapField { | ||
/* @var \CRM_Custom_Import_Form_MapField $form */ | ||
$form = $this->getFormObject('CRM_Custom_Import_Form_MapField', $submittedValues); | ||
return $form; | ||
} | ||
|
||
/** | ||
* Get the import's preview form. | ||
* | ||
* Defaults to contribution - other classes should override. | ||
* | ||
* @param array $submittedValues | ||
* | ||
* @return \CRM_Custom_Import_Form_Preview | ||
* @noinspection PhpUnnecessaryLocalVariableInspection | ||
*/ | ||
protected function getPreviewForm(array $submittedValues): CRM_Custom_Import_Form_Preview { | ||
/* @var CRM_Custom_Import_Form_Preview $form */ | ||
$form = $this->getFormObject('CRM_Custom_Import_Form_Preview', $submittedValues); | ||
return $form; | ||
} | ||
|
||
} |
4 changes: 4 additions & 0 deletions
4
tests/phpunit/CRM/Custom/Import/Parser/data/custom_data_date_select.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
The Contact ID,The Level,The School,The Start Year | ||
3,Red,Ah Ha,2010-12-01 | ||
3,R,Bah bah,2022-01-02 | ||
3,Aqua,Cah cah,2022-02-03 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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's a test failure:
I think maybe this file wasn't committed?
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.
Nice change from the extra file commits @demeritcowboy has been culling for me :-)