In issue #733192, it has been suggested that test code of the form:

$this->assertFalse(strcmp($target, $result), 'Assertion comment');

should be replaced by

$this->assertEqual($target, $result, 'Assertion comment');

The attached patch is the result of programmatically making such changes.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pillarsdotnet’s picture

Priority: Normal » Minor

I used the following commands to generate the patch:

git checkout 7.x
perl -pi -e 's|assertFalse\(strcmp\((.*), (.*)\), (.*)\)\;|assertEqual(\1, \2, \3)\;|' $(grep -rl 'assertFalse(strcmp' modules)
git diff --no-prefix > ~/Patches/d7/change-assertFalse-to-assertEqual.patch
pillarsdotnet’s picture

Clicking on View details reveals that all tests passed.

tstoeckler’s picture

Status: Needs review » Reviewed & tested by the community

Indeed.
The patch shows that there are still a lot of assertions using t(), but that's for another issue...
RTBC.

sun’s picture

Category: task » bug

This is a bug fix even. Because: http://de.php.net/manual/en/function.strcmp.php

Returns < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal.

Meaning: assertFalse(strcmp('foo', 'foo2')) == TRUE

Not true. But well, weird comparison technique anyway.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to Git.

Status: Fixed » Closed (fixed)

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