sebastianbergmann/phpcpd — pull request #65 by aboks (2013-05-24 11:29:36+00:00)
Title: Fixed incorrect token count in DefaultStrategy

Fixes #49

The problem was not that duplications of less than `$minTokens` were incorrectly included, but that all duplications were reported with 68 (`$minTokens - 2`) tokens less than they should have.

There is a bug in `DefaultStrategy` that calculates the last token of a duplication (and therefore also the number of tokens and lines) incorrectly. This PR:
* Fixes the bug, so that the size of the duplication is calculated and reported correctly.
* Changes the existing test in `DetectorTest` to expect also the last 68 tokens of the duplication to be expected.
* Adds 3 extra tests (that can be verified by hand more easily than the existing test) to DetectorTest.

More details can be found in the individual commit messages.