Problem/Motivation

#2829295: Improve test coverage and function docs: context introduced a regression. In ctools.test the short array syntax is used. This breaks PHP 5.3 testing for all modules that depend on CTools. See https://www.drupal.org/pift-ci-job/881689 for an example. Drupal 7 officially still supports PHP 5.2.4+, so I think we should avoid the short array syntax, even in tests.

Proposed resolution

Convert code to the long array syntax.

Remaining tasks

User interface changes

None.

Patch will follow.

API changes

None.

Data model changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

MegaChriz created an issue. See original summary.

MegaChriz’s picture

Assigned: MegaChriz » Unassigned
Status: Active » Needs review
FileSize
6.75 KB

This fixes ctools.test to use the long array syntax.

MegaChriz’s picture

Issue summary: View changes
tim.plunkett’s picture

Status: Needs review » Reviewed & tested by the community

Looks good!

  • japerry committed ebf43b1 on 7.x-1.x authored by MegaChriz
    Issue #2942581 by MegaChriz: ctools.test breaks Feeds tests on PHP 5.3...
japerry’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for noticing this! Fixed.

TR’s picture

Priority: Major » Critical
Status: Fixed » Active

Problem is, the short array syntax has already been included in the new ctools 7.x-1.13 release. Simply fixing the short array syntax doesn't change 7.x-1.13, it just fixes it in -dev.

So this is still a problem because the testbot checks out the most recent stable release of ctools, when testing modules that depend on ctools. PHP 5.3 testing for these modules is still broken!

What needs to happen here is a new stable release, 7.x-1.14, with the short array fix. Then the testbot won't generate syntax errors for ctools.test.

Also, it would be useful to change the ctools automated tests for D7 so that they test PHP 5.3, not just 5.6. That way things like this won't happen again in the future.

I'm reopening this and setting the priority to critical, because as I said the testing issue is not fixed yet and because the D7 modules I maintain (e.g. Ubercart) are now failing all tests because of this.

MegaChriz’s picture

@TR
For CTools, the tests on PHP 5.3 cannot run because there's a test dependency on the uuid module and the uuid module uses a trait in their tests (see https://www.drupal.org/pift-ci-job/881915). So if we want to prevent this from happening again in CTools, we should either forbid the uuid module to use a trait in their tests or remove the test dependency on the uuid module in CTools. A third option would be to patch Drupal 7 core in such way that scripts/run-tests.sh either doesn't index all test files or that it indexes the test files without interpreting them in PHP.

To fix the PHP 5.3 tests in Ubercart temporary you can define ctools as a test dependency with a version constraint:
test_dependencies[] = ctools:ctools (<= 7.x-1.12). I did this now for Feeds (before the patch was committed).

TR’s picture

I know I can work around this by restricting the version, but that's not the point - workarounds have a tendency to snowball, as we're seeing here. CTools avoids the situation by not testing against 5.3, but that means that any modules which use CTools can't test against 5.3 either and have to implement their own workarounds. Also, it's unacceptable, except as a temporary fix, to test against a year-old version of CTools when many if not most of the active sites using my module are going to be using the latest version - I need to ensure that my module works with the latest version of CTools.

Workarounds also need to go hand-in-hand with real fixes. In this case if the uuid module uses a trait, then uuid should declare a dependency on PHP 5.4. It doesn't. This is a bug, and I reopened the 18-month-old "won't fix" issue for that: #2783113: Using trait without PHP 5.4 requirement breaks Drupal CI of all modules that require UUID. Note that uuid does not have to use a trait here, as it doesn't add any functional benefit.

So CTools 7.x-1.13 is broken for several reasons:
1) CTools 7.x-1.13 "declares" that it supports the same minimum PHP 5.3 version that core supports (by not stating otherwise in ctools.info)
2) CTools 7.x-1.13 has short array syntax in ctools.test, which is not allowed in PHP 5.3
3) CTools 7.x-1.13 has a test dependency on uuid, and uuid has an implicit dependency on PHP 5.4.

CTools needs a 7.x-1.14 release which has these issues fixed.

Personally, I don't think it's acceptable to make CTools require PHP 5.4. My position is that if the uuid module won't do the simple thing and revert their use of a trait, then CTools shouldn't be using the uuid module, even if just for testing. CTools is so widely used that bumping the version to 5.4 is essentially forcing core to stop supporting 5.3.

joelpittet’s picture

Priority: Critical » Normal
Status: Active » Fixed
Parent issue: » #2941916: Plan for CTools 7.x-1.14 release

This will be included in 1.14. The release will come but there are a few issues to consider. Attaching this to the release plan issue. Please leave the status as 'fixed'

TR’s picture

Priority: Normal » Critical
Status: Fixed » Active

Okay ... but you didn't update that plan to address the issue with the uuid module and how to deal with that within CTools ... Maybe you can participate in the uuid issue to try to move this forward? Also, there's no indication of any sort of urgency in the plan - right now PHP 5.3 testing is broken for a broad range of modules (for example, Views module testing, among others, is failing with PHP 5.3). Is the plan to just make a new release 'eventually'? Perhaps the list of desired improvements should be cut short so that a new release can come sooner to fix the broken 1.13 release?

TR’s picture

Priority: Critical » Normal
Status: Active » Fixed

Sorry, didn't mean to change the priority and status.

DamienMcKenna’s picture

Would you mind releasing 1.14 to fix this? Tests for all modules which depend upon it, including Metatag, are currently broken.

joelpittet’s picture

Already in the queue to be fixed... just need the other related and issues to be resolved too I hope.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.