Download & Extend

Fix FieldAttachTestCase::setUp() signature

Project:Drupal core
Version:7.x-dev
Component:simpletest.module
Category:task
Priority:normal
Assigned:Unassigned
Status:closed (fixed)
Issue tags:needs backport to D7

Issue Summary

From #520106-132: Allow setting the active menu trail for dynamically-generated menu paths., apparently classes which inherit from DrupalWebTestCase need to have the following function signature for setUp:

function setUp() {
  // ...
}

In FieldAttachTestCase, the signature is

function setUp($modules = array()) {
  // ...
}
which apparently can raise an E_STRICT warning.

Instead we should use something like

function setUp() {
  $modules = func_get_args();
  if (isset($modules[0]) && is_array($modules[0])) {
    $modules = $modules[0];
  }
  // ...

Comments

#1

Status:active» needs review

Code borrowed from DrupalWebTestCase::setUp(), of course.

AttachmentSizeStatusTest resultOperations
FieldAttachTestCase-1273722-1.patch1.23 KBIdlePASSED: [[SimpleTest]]: [MySQL] 34,383 pass(es).View details

#2

This should be trivial to review and fixes an E_STRICT warning.

#3

Status:needs review» reviewed & tested by the community

That's 100% correct. Thank you!

#4

#1: FieldAttachTestCase-1273722-1.patch queued for re-testing.

#5

Version:8.x-dev» 7.x-dev
Status:reviewed & tested by the community» patch (to be ported)

Committed/pushed to 8.x, will need a quick re-roll for 7.x.

#6

Status:patch (to be ported)» reviewed & tested by the community

Quick re-roll for D7...
$ curl http://drupal.org/files/FieldAttachTestCase-1273722-1.patch | git apply -p2 --index

AttachmentSizeStatusTest resultOperations
FieldAttachTestCase-1273722-7.patch871 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 37,253 pass(es).View details

#7

Status:reviewed & tested by the community» fixed

Huh. Weird. I thought we changed DWTC::setUp() some time ago to take $modules as a parameter and get away from the function_get_args() way. Hm. Well, ok, then...

Committed and pushed to 7.x. Thanks!

#8

Status:fixed» closed (fixed)

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