Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
| 1 | <?php |
||
| 5 | use Helper\Unit; |
||
| 6 | use Nord\Lumen\OAuth2\OAuth2Service; |
||
| 7 | |||
| 8 | class OAuth2ServiceTest extends \Codeception\Test\Unit |
||
| 9 | { |
||
| 10 | use \Codeception\Specify; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * @var OAuth2Service |
||
| 14 | */ |
||
| 15 | private $service; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @inheritdoc |
||
| 19 | */ |
||
| 20 | protected function setup() |
||
| 25 | |||
| 26 | /** |
||
| 27 | * |
||
| 28 | */ |
||
| 29 | public function testAssertIssueAccessToken() |
||
| 35 | |||
| 36 | /** |
||
| 37 | * |
||
| 38 | */ |
||
| 39 | public function testAssertValidateAccessToken() |
||
| 45 | |||
| 46 | /** |
||
| 47 | * |
||
| 48 | */ |
||
| 49 | public function testAssertGetResourceOwnerId() |
||
| 56 | |||
| 57 | /** |
||
| 58 | * |
||
| 59 | */ |
||
| 60 | public function testAssertGetResourceOwnerType() |
||
| 67 | |||
| 68 | /** |
||
| 69 | * |
||
| 70 | */ |
||
| 71 | public function testAssertGetClientId() |
||
| 78 | } |
||
| 79 |