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

Fix test which fails when run in isolation. #14517

Merged
merged 1 commit into from
Jun 13, 2019

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Jun 13, 2019

Overview

Test fix only

Before

Test passes when run in suite but fails in isolation

After

Tes also passes in isolation

Technical Details

There is a mystery contamination in our test suite somewhere where this test passes in a
suite & not by itself - this fixes although the fact this passes when not alone is
probably behind a few hard to find issues

  • fail is
Failure in api call for Membership create:  membership_type_id is not valid : General
 INSERT INTO civicrm_financial_item (transaction_date , contact_id , description , amount , currency , financial_account_id , status_id , entity_table , entity_id ) VALUES ( 0 ,  4 , 'General' ,  100 , 'USD' ,  2 ,  1 , 'civicrm_line_item' ,  4 )  [nativecode=1292 ** Incorrect datetime value: '0' for column 'transaction_date' at row 1]
#0 /Users/eileenmcnaughton/buildkit/build/dmaster/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(922): CRM_Core_Error::exceptionHandler(Object(DB_Error))
#1 /Users/eileenmcnaughton/buildkit/build/dmaster/sites/all/modules/civicrm/packages/DB.php(985): PEAR_Error->__construct('DB Error: unkno...', -1, 16, Array, 'INSERT INTO civ...')
#2 /Users/eileenmcnaughton/buildkit/build/dmaster/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(575): DB_Error->__construct(-1, 16, Array, 'INSERT INTO civ...')
#3 /Users/eileenmcnaughton/buildkit/build/dmaster/sites/all/modules/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(223): PEAR->_raiseError(Object(DB_mysqli), NULL, -1, 16, Array, 'INSERT INTO civ...', 'DB_Error', true)
#4 /Users/eileenmcnaughton/buildkit/build/dmaster/sites/all/modules/civicrm/packages/DB/common.php(1907): PEAR->__call('raiseError', Array)
#5 /Users/eileenmcnaughton/buildkit/build/dmaster/sites/all/modules/civicrm/packages/DB/mysqli.php(933): DB_common->raiseError(-1, NULL, NULL, 'INSERT INTO civ...', '1292 ** Incorre...')
#6 /Users/eileenmcnaughton/buildkit/build/dmaster/sites/all/modules/civicrm/packages/DB/mysqli.php(403): DB_mysqli->mysqliRaiseError()
#7 /Users/eileenmcnaughton/buildkit/build/dmaster/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysqli->simpleQuery('INSERT INTO civ...')
#8 /Users/eileenmcnaughton/buildkit/build/dmaster/sites/all/modules/civicrm/packages/DB/DataObject.php(2415): DB_common->query('INSERT INTO civ...')
#9 /Users/eileenmcnaughton/buildkit/build/dmaster/sites/all/modules/civicrm/packages/DB/DataObject.php(1040): DB_DataObject->_query('INSERT INTO civ...')
#10 /Users/eileenmcnaughton/buildkit/build/dmaster/sites/all/modules/civicrm/CRM/Core/DAO.php(572): DB_DataObject->insert()
#11 /Users/eileenmcnaughton/buildkit/build/dmaster/sites/all/modules/civicrm/CRM/Financial/BAO/FinancialItem.php(160): CRM_Core_DAO->save()
#12 /Users/eileenmcnaughton/buildkit/build/dmaster/sites/all/modules/civicrm/CRM/Financial/BAO/FinancialItem.php(129): CRM_Financial_BAO_FinancialItem::create(Array, NULL, Array)
#13 /Users/eileenmcnaughton/buildkit/build/dmaster/sites/all/modules/civicrm/CRM/Price/BAO/LineItem.php(473): CRM_Financial_BAO_FinancialItem::add(Object(CRM_Price_BAO_LineItem), Object(CRM_Contribute_BAO_Contribution))
#14 /Users/eileenmcnaughton/buildkit/build/dmaster/sites/all/modules/civicrm/CRM/Member/BAO/Membership.php(394): CRM_Price_BAO_LineItem::processPriceSet(1, Array, Object(CRM_Contribute_BAO_Contribution))
#15 /Users/eileenmcnaughton/buildkit/build/dmaster/sites/all/modules/civicrm/api/v3/Membership.php(150): CRM_Member_BAO_Membership::create(Array, Array, true)
#16 /Users/eileenmcnaughton/buildkit/build/dmaster/sites/all/modules/civicrm/Civi/API/Provider/MagicFunctionProvider.php(101): civicrm_api3_membership_create(Array)
#17 /Users/eileenmcnaughton/buildkit/build/dmaster/sites/all/modules/civicrm/Civi/API/Kernel.php(168): Civi\API\Provider\MagicFunctionProvider->invoke(Array)
#18 /Users/eileenmcnaughton/buildkit/build/dmaster/sites/all/modules/civicrm/Civi/API/Kernel.php(99): Civi\API\Kernel->runRequest(Array)
#19 /Users/eileenmcnaughton/buildkit/build/dmaster/sites/all/modules/civicrm/api/api.php(23): Civi\API\Kernel->runSafe('Membership', 'create', Array, NULL)
#20 /Users/eileenmcnaughton/buildkit/build/dmaster/sites/all/modules/civicrm/Civi/Test/Api3TestTrait.php(282): civicrm_api('Membership', 'create', Array)
#21 /Users/eileenmcnaughton/buildkit/build/dmaster/sites/all/modules/civicrm/Civi/Test/Api3TestTrait.php(163): CiviUnitTestCase->civicrm_api('Membership', 'create', Array)
#22 /Users/eileenmcnaughton/buildkit/build/dmaster/sites/all/modules/civicrm/tests/phpunit/CiviTest/CiviUnitTestCase.php(595): CiviUnitTestCase->callAPISuccess('Membership', 'create', Array)
#23 /Users/eileenmcnaughton/buildkit/build/dmaster/sites/all/modules/civicrm/tests/phpunit/CRM/Contribute/Page/AjaxTest.php(150): CiviUnitTestCase->contactMembershipCreate(Array)
#24 [internal function]: CRM_Contribute_Page_AjaxTest->testGetSoftContributionForMembership()
#25 /Users/eileenmcnaughton/vendor/phpunit/phpunit/src/Framework/TestCase.php(1062): ReflectionMethod->invokeArgs(Object(CRM_Contribute_Page_AjaxTest), Array)
#26 /Users/eileenmcnaughton/buildkit/build/dmaster/sites/all/modules/civicrm/tests/phpunit/CiviTest/CiviUnitTestCase.php(215): PHPUnit_Framework_TestCase->runTest()
#27 /Users/eileenmcnaughton/vendor/phpunit/phpunit/src/Framework/TestCase.php(913): CiviUnitTestCase->runTest()
#28 /Users/eileenmcnaughton/vendor/phpunit/phpunit/src/Framework/TestResult.php(686): PHPUnit_Framework_TestCase->runBare()
#29 /Users/eileenmcnaughton/vendor/phpunit/phpunit/src/Framework/TestCase.php(868): PHPUnit_Framework_TestResult->run(Object(CRM_Contribute_Page_AjaxTest))
#30 /Users/eileenmcnaughton/vendor/phpunit/phpunit/src/Framework/TestSuite.php(733): PHPUnit_Framework_TestCase->run(Object(PHPUnit_Framework_TestResult))
#31 /Users/eileenmcnaughton/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(517): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult))
#32 /Users/eileenmcnaughton/vendor/phpunit/phpunit/src/TextUI/Command.php(186): PHPUnit_TextUI_TestRunner->doRun(Object(PHPUnit_Framework_TestSuite), Array, true)
#33 /Users/eileenmcnaughton/vendor/phpunit/phpunit/src/TextUI/Command.php(116): PHPUnit_TextUI_Command->run(Array, true)
#34 /Users/eileenmcnaughton/vendor/phpunit/phpunit/phpunit(52): PHPUnit_TextUI_Command::main()

Comments

There is a mystery contamination in our test suite somewhere where this test passes in a
suite & not by itself - this fixes although the fact this passes when not alone is
probably behind a few hard to find issues
@civibot
Copy link

civibot bot commented Jun 13, 2019

(Standard links)

@seamuslee001
Copy link
Contributor

as this is tests only adding merge on pass

@seamuslee001 seamuslee001 merged commit 1849054 into civicrm:master Jun 13, 2019
@seamuslee001 seamuslee001 deleted the test_fix branch June 13, 2019 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants