sebastianbergmann/phpunit — Issue #514: assertStringMatchesFormat failures show too many diffs
Author: convissor
Created: 2012-02-28 14:28:55+00:00
State: open

The assertStringMatchesFormat() and assertStringMatchesFormatFile() methods have a problem when _some_ of the $string parameter doesn't match the $format parameter. In this situation, the diff output generator does not utilize the matching routines. Thus the output includes lines that actually match the pattern. The extra output distracts from the real error that needs to be fixed.

```
public function test_match_string() {
$format = "this %s may be bad\nthis %s should be good";

$string = "this line may be bad\nthis line should be good";
$this->assertStringMatchesFormat($format, $string, 'string test pass');

$string = "this may be bad\nthis line should be good";
$this->assertStringMatchesFormat($format, $string, 'string test fail');
}
```