CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • Unit Testing (Moderator: Michał Mach) »
  • Getting started with unit tests
Pages: [1]

Author Topic: Getting started with unit tests  (Read 6567 times)

jcm55

  • I post occasionally
  • **
  • Posts: 96
  • Karma: 14
Getting started with unit tests
March 11, 2012, 10:21:56 pm
Trying to get a sandbox up and running so I can attempt to reproduce Eileen's results in CRM-9781.
I've got a fresh install of D7 + Civi 4.1.1.  Checked out trunk and followed instructions here:

http://wiki.civicrm.org/confluence/display/CRM/Setting+up+your+personal+testing+sandbox+HOWTO

However, when I try to run I test, I'm getting an error:

Code: [Select]
jmeehan@ubuntu:~/public_html/sites/all/modules/civicrm$ tools/scripts/phpunit -ujmeehan -pDELETED -hlocalhost -bcivicrm_tests_dev api_v3_ContactTest
PHPUnit 3.4.3 by Sebastian Bergmann.


Installing civicrm_tests_dev database
............PHP Fatal error:  Call to undefined method CRM_Logging_Schema::createTriggersFor() in /home/jmeehan/public_html/sites/all/modules/civicrm/CRM/Core/BAO/SchemaHandler.php on line 307

Any ideas on what I'm doing wrong?  I double-checked, and my mysql user does have SUPER privs.



xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Getting started with unit tests
March 12, 2012, 12:05:52 am
Hi,

Is your php-cli config set to display errors? I'd have expected more bla bla and include path .

Not the cause of the problem, but I found useful to have xdebug running on my dev server (it gives more detailed error messages)

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

jcm55

  • I post occasionally
  • **
  • Posts: 96
  • Karma: 14
Re: Getting started with unit tests
March 12, 2012, 07:30:30 am
Okay, display_errors turned on now.  See below.  However, I don't see createTriggersFor() defined in CRM/Logging/Schema.php.  Actually, I don't see it defined anywhere in the civicrm directory tree:

Code: [Select]
jmeehan@ubuntu:~/public_html/sites/all/modules/civicrm$ find . -print | xargs grep createTriggersFor
grep: ./packages/jquery/plugins/DataTables/media/images/.svn/text-base/Sorting: No such file or directory
grep: icons.psd.svn-base: No such file or directory
grep: ./packages/jquery/plugins/DataTables/media/images/.svn/prop-base/Sorting: No such file or directory
grep: icons.psd.svn-base: No such file or directory
grep: ./packages/jquery/plugins/DataTables/media/images/Sorting: No such file or directory
grep: icons.psd: No such file or directory
./CRM/Core/BAO/SchemaHandler.php:            $logging->createTriggersFor($params['table_name']);
./CRM/Core/BAO/.svn/text-base/SchemaHandler.php.svn-base:            $logging->createTriggersFor($params['table_name']);


Here's the traceback with error_reporting turned on:

Code: [Select]

jmeehan@ubuntu:~/public_html/sites/all/modules/civicrm$ tools/scripts/phpunit -ujmeehan -pDELETED -hlocalhost -bcivicrm_tests_dev api_v3_ContactTest
PHPUnit 3.4.3 by Sebastian Bergmann.


Installing civicrm_tests_dev database
............PHP Fatal error:  Call to undefined method CRM_Logging_Schema::createTriggersFor() in /home/jmeehan/public_html/sites/all/modules/civicrm/CRM/Core/BAO/SchemaHandler.php on line 307
PHP Stack trace:
PHP   1. {main}() /home/jmeehan/public_html/sites/all/modules/civicrm/tools/scripts/phpunit:0
PHP   2. PHPUnit_TextUI_Command::main() /home/jmeehan/public_html/sites/all/modules/civicrm/tools/scripts/phpunit:74
PHP   3. PHPUnit_TextUI_Command->run() /home/jmeehan/public_html/sites/all/modules/civicrm/tools/packages/PHPUnit/TextUI/Command.php:155
PHP   4. PHPUnit_TextUI_TestRunner->doRun() /home/jmeehan/public_html/sites/all/modules/civicrm/tools/packages/PHPUnit/TextUI/Command.php:251
PHP   5. PHPUnit_Framework_TestSuite->run() /home/jmeehan/public_html/sites/all/modules/civicrm/tools/packages/PHPUnit/TextUI/TestRunner.php:350
PHP   6. PHPUnit_Framework_TestSuite->runTest() /home/jmeehan/public_html/sites/all/modules/civicrm/tools/packages/PHPUnit/Framework/TestSuite.php:732
PHP   7. PHPUnit_Framework_TestCase->run() /home/jmeehan/public_html/sites/all/modules/civicrm/tools/packages/PHPUnit/Framework/TestSuite.php:757
PHP   8. PHPUnit_Framework_TestResult->run() /home/jmeehan/public_html/sites/all/modules/civicrm/tools/packages/PHPUnit/Framework/TestCase.php:653
PHP   9. PHPUnit_Framework_TestCase->runBare() /home/jmeehan/public_html/sites/all/modules/civicrm/tools/packages/PHPUnit/Framework/TestResult.php:687
PHP  10. PHPUnit_Framework_TestCase->runTest() /home/jmeehan/public_html/sites/all/modules/civicrm/tools/packages/PHPUnit/Framework/TestCase.php:706
PHP  11. ReflectionMethod->invokeArgs() /home/jmeehan/public_html/sites/all/modules/civicrm/tools/packages/PHPUnit/Framework/TestCase.php:822
PHP  12. api_v3_ContactTest->testCreateWithCustom() /home/jmeehan/public_html/sites/all/modules/civicrm/tests/phpunit/api/v3/ContactTest.php:0
PHP  13. CiviUnitTestCase->customFieldDelete() /home/jmeehan/public_html/sites/all/modules/civicrm/tests/phpunit/api/v3/ContactTest.php:351
PHP  14. civicrm_api() /home/jmeehan/public_html/sites/all/modules/civicrm/tests/phpunit/CiviTest/CiviUnitTestCase.php:1620
PHP  15. civicrm_api3_custom_field_delete() /home/jmeehan/public_html/sites/all/modules/civicrm/api/api.php:57
PHP  16. CRM_Core_BAO_CustomField::deleteField() /home/jmeehan/public_html/sites/all/modules/civicrm/api/v3/CustomField.php:128
PHP  17. CRM_Core_BAO_CustomField::createField() /home/jmeehan/public_html/sites/all/modules/civicrm/CRM/Core/BAO/CustomField.php:993
PHP  18. CRM_Core_BAO_SchemaHandler::alterFieldSQL() /home/jmeehan/public_html/sites/all/modules/civicrm/CRM/Core/BAO/CustomField.php:1695

Fatal error: Call to undefined method CRM_Logging_Schema::createTriggersFor() in /home/jmeehan/public_html/sites/all/modules/civicrm/CRM/Core/BAO/SchemaHandler.php on line 307

Call Stack:
    0.0003     331740   1. {main}() /home/jmeehan/public_html/sites/all/modules/civicrm/tools/scripts/phpunit:0
    0.0359    4722860   2. PHPUnit_TextUI_Command::main() /home/jmeehan/public_html/sites/all/modules/civicrm/tools/scripts/phpunit:74
    0.0360    4724000   3. PHPUnit_TextUI_Command->run() /home/jmeehan/public_html/sites/all/modules/civicrm/tools/packages/PHPUnit/TextUI/Command.php:155
    0.1546   21102680   4. PHPUnit_TextUI_TestRunner->doRun() /home/jmeehan/public_html/sites/all/modules/civicrm/tools/packages/PHPUnit/TextUI/Command.php:251
    0.5784   21762584   5. PHPUnit_Framework_TestSuite->run() /home/jmeehan/public_html/sites/all/modules/civicrm/tools/packages/PHPUnit/TextUI/TestRunner.php:350
    1.5851   37125512   6. PHPUnit_Framework_TestSuite->runTest() /home/jmeehan/public_html/sites/all/modules/civicrm/tools/packages/PHPUnit/Framework/TestSuite.php:732
    1.5851   37125512   7. PHPUnit_Framework_TestCase->run() /home/jmeehan/public_html/sites/all/modules/civicrm/tools/packages/PHPUnit/Framework/TestSuite.php:757
    1.5852   37125512   8. PHPUnit_Framework_TestResult->run() /home/jmeehan/public_html/sites/all/modules/civicrm/tools/packages/PHPUnit/Framework/TestCase.php:653
    1.5856   37126728   9. PHPUnit_Framework_TestCase->runBare() /home/jmeehan/public_html/sites/all/modules/civicrm/tools/packages/PHPUnit/Framework/TestResult.php:687
    1.5870   37164988  10. PHPUnit_Framework_TestCase->runTest() /home/jmeehan/public_html/sites/all/modules/civicrm/tools/packages/PHPUnit/Framework/TestCase.php:706
    1.5870   37166100  11. ReflectionMethod->invokeArgs() /home/jmeehan/public_html/sites/all/modules/civicrm/tools/packages/PHPUnit/Framework/TestCase.php:822
    1.5870   37166128  12. api_v3_ContactTest->testCreateWithCustom() /home/jmeehan/public_html/sites/all/modules/civicrm/tests/phpunit/api/v3/ContactTest.php:0
    1.7435   38594500  13. CiviUnitTestCase->customFieldDelete() /home/jmeehan/public_html/sites/all/modules/civicrm/tests/phpunit/api/v3/ContactTest.php:351
    1.7435   38595000  14. civicrm_api() /home/jmeehan/public_html/sites/all/modules/civicrm/tests/phpunit/CiviTest/CiviUnitTestCase.php:1620
    1.7489   38610088  15. civicrm_api3_custom_field_delete() /home/jmeehan/public_html/sites/all/modules/civicrm/api/api.php:57
    1.7497   38621976  16. CRM_Core_BAO_CustomField::deleteField() /home/jmeehan/public_html/sites/all/modules/civicrm/api/v3/CustomField.php:128
    1.7523   38573168  17. CRM_Core_BAO_CustomField::createField() /home/jmeehan/public_html/sites/all/modules/civicrm/CRM/Core/BAO/CustomField.php:993
    1.7532   38576136  18. CRM_Core_BAO_SchemaHandler::alterFieldSQL() /home/jmeehan/public_html/sites/all/modules/civicrm/CRM/Core/BAO/CustomField.php:1695

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Getting started with unit tests
March 12, 2012, 09:11:07 am

can you check out branch v4.1:

http://svn.civicrm.org/civicrm/branches/v4.1/

trunk is 4.2 and we've made changes to the trigger code and hence the error.

If you can file the below issue for 4.2 that would be great, which will ensure we fix it before we release 4.2 :)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • Unit Testing (Moderator: Michał Mach) »
  • Getting started with unit tests

This forum was archived on 2017-11-26.