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) »
  • PHPUnit in packages outdated
Pages: [1]

Author Topic: PHPUnit in packages outdated  (Read 703 times)

OpenBrian

  • I’m new here
  • *
  • Posts: 4
  • Karma: 0
  • CiviCRM version: 4.2.7
  • CMS version: Drupal 7
  • MySQL version: PostgreSQL 8.4
  • PHP version: 5.3.3
PHPUnit in packages outdated
September 07, 2015, 10:13:13 pm
So, i'm just getting a CI infrastructure up and running by following instructions https://buildkit.civicrm.org/#/tutorials.  I'm getting this warning 48 times:

PHP Deprecated:  preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /opt/buildkit/build/jenkins-1/sites/all/modules/civicrm/packages/PHPUnit/Util/XML.php on line 74

I'm running PHP 5.6.9, which is now in debian stable.  Ubuntu 14.04 has PHP 5.5.  The /e modifier is deprecated in PHP 5.5.  So this warning must be pretty wide spread.

The version of PHPUnit in civicrm-packages is 3.6, while the lastest stable is 4.8.  Will civicrm upgrade soon?

totten

  • Administrator
  • Ask me questions
  • *****
  • Posts: 695
  • Karma: 64
Re: PHPUnit in packages outdated
September 08, 2015, 04:23:02 pm
There's no existing/concrete plan, although it's generally patch-welcome.

Background: Civi has embedded a full copy of phpunit in civicrm-packages. In the past, this was used to hack in some patches, but it makes upgrading hard/mysterious, and I don't really think it's worthwhile. During the 4.5 or 4.6 cycle, I spent a chunk of time getting tests to run on standalone phpunit instead of embedded phpunit -- but couldn't quite bring myself to pull the trigger, and there may be a few tests which don't pass in standalone.

Suggestion: Try running each of the test suites with phpunit standalone, e.g.

Code: [Select]
cd sites/all/modules/civicrm
phpunit tests/phpunit/Civi/
phpunit tests/phpunit/CRM/
phpunit tests/phpunit/api/v3/

If they do work, then try a newer version of phpunit standalone.

(Note: Civi depends on two phpunit plugins, "dbunit" and "phpunit-selenium". The way to load these depends on how phpunit is installed. It's possible to install phpunit via composer, apt-get, and/or phar, but I don't know details of every permutation. For a working example, see buildkit's composer.json.)

If the tests do work with the standalone version, then I'd vote for this arrangement:

  • Buildkit should include a newer version of phpunit. (Update composer.json and composer.lock) This provides a common baseline for folks working with Civi.
  • If a future developer wants to use a different version of phpunit, he can install it on his own and set the PATH accordingly.
  • The file "tools/scripts/phpunit" should be replaced with a dummy bash script that just calls standalone phpunit.
  • The wiki http://wiki.civicrm.org/confluence/display/CRMDOC/Testing should use standalone "phpunit" (instead of "cd scripts; ./tools/phpunit").
  • Remove the embedded copy of phpunit from civicrm-packages.
« Last Edit: September 08, 2015, 04:24:58 pm by totten »

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • Unit Testing (Moderator: Michał Mach) »
  • PHPUnit in packages outdated

This forum was archived on 2017-11-26.