diff --git a/.gitignore b/.gitignore index 3a9875b..65252fb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /vendor/ -composer.lock +/composer.lock +/.php_cs.cache diff --git a/.php_cs b/.php_cs index 8528738..e3ffa9f 100644 --- a/.php_cs +++ b/.php_cs @@ -1,30 +1,24 @@ in(__DIR__); return CS\Config::create() - ->level(CS\FixerInterface::PSR2_LEVEL) - ->fixers([ - 'blankline_after_open_tag', - 'concat_with_spaces', - 'join_function', - 'native_function_casing', - 'no_blank_lines_after_class_opening', - 'ordered_use', - 'phpdoc_no_access', - 'remove_leading_slash_use', - 'remove_leading_slash_uses', - 'self_accessor', - 'short_array_syntax', - 'spaces_cast', - 'unused_use', - 'whitespacy_lines' + ->setRules([ + '@PSR2' => true, + 'array_syntax' => ['syntax' => 'short'], + 'blank_line_after_opening_tag' => true, + 'concat_space' => ['spacing' => 'one'], + 'native_function_casing' => true, + 'no_blank_lines_after_class_opening' => true, + 'no_unused_imports' => true, + 'no_unused_imports' => true, + 'no_whitespace_in_blank_line' => true, + 'ordered_imports' => true, + 'phpdoc_no_access' => true, + 'self_accessor' => true ]) - ->finder( - CS\Finder::create() - ->files() - ->name(__FILE__) - ->name('*.php') - ->in(__DIR__) - ); + ->setFinder($finder) +; diff --git a/classes/score/coverage.php b/classes/score/coverage.php index 1b5c550..cb9125f 100644 --- a/classes/score/coverage.php +++ b/classes/score/coverage.php @@ -107,10 +107,14 @@ public function merge(self $coverage) public function addToModel(model $model) { $model->coverageIs( - $this->totalLines, $this->coveredLines, - $this->totalBranches, $this->coveredBranches, - $this->totalPaths, $this->coveredPaths, - $this->totalOps, count($this->coveredOps ?: []) + $this->additionalCoveredOps + $this->totalLines, + $this->coveredLines, + $this->totalBranches, + $this->coveredBranches, + $this->totalPaths, + $this->coveredPaths, + $this->totalOps, + count($this->coveredOps ?: []) + $this->additionalCoveredOps ); return $this; diff --git a/composer.json b/composer.json index 2ab02e4..dfa865b 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ "atoum/atoum": "^2.9 | ^3.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "~1.12" + "friendsofphp/php-cs-fixer": "^2" }, "autoload": { "psr-4": { diff --git a/tests/units/classes/model/coverage.php b/tests/units/classes/model/coverage.php index 2e24ffe..d3012f0 100644 --- a/tests/units/classes/model/coverage.php +++ b/tests/units/classes/model/coverage.php @@ -17,10 +17,14 @@ public function testCoverageIs() ->given( $this->mockGenerator->shuntParentClassCalls(), $template = new \mock\mageekguy\atoum\reports\template(uniqid()), - $totalLines = rand(1, PHP_INT_MAX), $coveredLines = rand(1, PHP_INT_MAX), - $totalBranches = rand(1, PHP_INT_MAX), $coveredBranches = rand(1, PHP_INT_MAX), - $totalPaths = rand(1, PHP_INT_MAX), $coveredPaths = rand(1, PHP_INT_MAX), - $totalOps = rand(1, PHP_INT_MAX), $coveredOps = rand(1, PHP_INT_MAX) + $totalLines = rand(1, PHP_INT_MAX), + $coveredLines = rand(1, PHP_INT_MAX), + $totalBranches = rand(1, PHP_INT_MAX), + $coveredBranches = rand(1, PHP_INT_MAX), + $totalPaths = rand(1, PHP_INT_MAX), + $coveredPaths = rand(1, PHP_INT_MAX), + $totalOps = rand(1, PHP_INT_MAX), + $coveredOps = rand(1, PHP_INT_MAX) ) ->if($this->newTestedInstance) ->then diff --git a/tests/units/classes/model/coverage/klass.php b/tests/units/classes/model/coverage/klass.php index b535619..f985721 100644 --- a/tests/units/classes/model/coverage/klass.php +++ b/tests/units/classes/model/coverage/klass.php @@ -18,10 +18,14 @@ public function testCoverageIs() $class = uniqid(), $this->mockGenerator->shuntParentClassCalls(), $template = new \mock\mageekguy\atoum\reports\template(uniqid()), - $totalLines = rand(1, PHP_INT_MAX), $coveredLines = rand(1, PHP_INT_MAX), - $totalBranches = rand(1, PHP_INT_MAX), $coveredBranches = rand(1, PHP_INT_MAX), - $totalPaths = rand(1, PHP_INT_MAX), $coveredPaths = rand(1, PHP_INT_MAX), - $totalOps = rand(1, PHP_INT_MAX), $coveredOps = rand(1, PHP_INT_MAX) + $totalLines = rand(1, PHP_INT_MAX), + $coveredLines = rand(1, PHP_INT_MAX), + $totalBranches = rand(1, PHP_INT_MAX), + $coveredBranches = rand(1, PHP_INT_MAX), + $totalPaths = rand(1, PHP_INT_MAX), + $coveredPaths = rand(1, PHP_INT_MAX), + $totalOps = rand(1, PHP_INT_MAX), + $coveredOps = rand(1, PHP_INT_MAX) ) ->if($this->newTestedInstance($class)) ->then diff --git a/tests/units/classes/model/coverage/method.php b/tests/units/classes/model/coverage/method.php index aaaca34..cb0d651 100644 --- a/tests/units/classes/model/coverage/method.php +++ b/tests/units/classes/model/coverage/method.php @@ -18,10 +18,14 @@ public function testCoverageIs() $method = uniqid(), $this->mockGenerator->shuntParentClassCalls(), $template = new \mock\mageekguy\atoum\reports\template(uniqid()), - $totalLines = rand(1, PHP_INT_MAX), $coveredLines = rand(1, PHP_INT_MAX), - $totalBranches = rand(1, PHP_INT_MAX), $coveredBranches = rand(1, PHP_INT_MAX), - $totalPaths = rand(1, PHP_INT_MAX), $coveredPaths = rand(1, PHP_INT_MAX), - $totalOps = rand(1, PHP_INT_MAX), $coveredOps = rand(1, PHP_INT_MAX) + $totalLines = rand(1, PHP_INT_MAX), + $coveredLines = rand(1, PHP_INT_MAX), + $totalBranches = rand(1, PHP_INT_MAX), + $coveredBranches = rand(1, PHP_INT_MAX), + $totalPaths = rand(1, PHP_INT_MAX), + $coveredPaths = rand(1, PHP_INT_MAX), + $totalOps = rand(1, PHP_INT_MAX), + $coveredOps = rand(1, PHP_INT_MAX) ) ->if($this->newTestedInstance($method)) ->then