Skip to content
This repository has been archived by the owner on Aug 17, 2023. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/collection' into interface
Browse files Browse the repository at this point in the history
  • Loading branch information
holyshared committed May 10, 2015
2 parents 3fc8743 + e4958a9 commit bda83ec
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 42 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Version 2.0.0
* AnalyzerInterface to Analyzer
* AbstractTypeResultInterface to AbstractTypeResultNode
* CoverageResultCollectionInterface to CoverageResultNodeCollection
* Remove LineResultCollectionInterface


Version 1.8.3
Expand Down
18 changes: 10 additions & 8 deletions spec/result/CoverageResult.spec.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@

use cloak\value\Coverage;
use cloak\spec\result\FixtureCoverageResult;
use cloak\result\LineResultCollectionInterface;
use cloak\result\CoverageResult;
use cloak\result\LineCountResult;
use cloak\result\CodeCoverageResult;
use Prophecy\Prophet;


Expand All @@ -20,7 +22,7 @@
beforeEach(function() {
$this->prophet = new Prophet();

$lineResult = $this->prophet->prophesize(LineResultCollectionInterface::class);
$lineResult = $this->prophet->prophesize(LineCountResult::class);
$lineResult->getLineCount()->willReturn(10);

$this->result = new FixtureCoverageResult( $lineResult->reveal() );
Expand All @@ -34,7 +36,7 @@
beforeEach(function() {
$this->prophet = new Prophet();

$lineResult = $this->prophet->prophesize(LineResultCollectionInterface::class);
$lineResult = $this->prophet->prophesize(LineCountResult::class);
$lineResult->getDeadLineCount()->willReturn(10);

$this->result = new FixtureCoverageResult( $lineResult->reveal() );
Expand All @@ -48,7 +50,7 @@
beforeEach(function() {
$this->prophet = new Prophet();

$lineResult = $this->prophet->prophesize(LineResultCollectionInterface::class);
$lineResult = $this->prophet->prophesize(LineCountResult::class);
$lineResult->getUnusedLineCount()->willReturn(10);

$this->result = new FixtureCoverageResult( $lineResult->reveal() );
Expand All @@ -62,7 +64,7 @@
beforeEach(function() {
$this->prophet = new Prophet();

$lineResult = $this->prophet->prophesize(LineResultCollectionInterface::class);
$lineResult = $this->prophet->prophesize(LineCountResult::class);
$lineResult->getExecutedLineCount()->willReturn(10);

$this->result = new FixtureCoverageResult( $lineResult->reveal() );
Expand All @@ -76,7 +78,7 @@
beforeEach(function() {
$this->prophet = new Prophet();

$lineResult = $this->prophet->prophesize(LineResultCollectionInterface::class);
$lineResult = $this->prophet->prophesize(CodeCoverageResult::class);
$lineResult->getCodeCoverage()->willReturn(100);

$this->result = new FixtureCoverageResult( $lineResult->reveal() );
Expand All @@ -91,7 +93,7 @@
$this->prophet = new Prophet();
$this->coverage = new Coverage(51);

$lineResult = $this->prophet->prophesize(LineResultCollectionInterface::class);
$lineResult = $this->prophet->prophesize(CodeCoverageResult::class);
$lineResult->isCoverageLessThan($this->coverage)->willReturn(true);

$this->result = new FixtureCoverageResult( $lineResult->reveal() );
Expand All @@ -107,7 +109,7 @@
$this->prophet = new Prophet();
$this->coverage = new Coverage(51);

$lineResult = $this->prophet->prophesize(LineResultCollectionInterface::class);
$lineResult = $this->prophet->prophesize(CodeCoverageResult::class);
$lineResult->isCoverageGreaterEqual($this->coverage)
->willReturn(false);

Expand Down
7 changes: 3 additions & 4 deletions spec/result/FileResult.spec.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@
use cloak\result\FileResult;
use cloak\result\LineResult;
use cloak\result\collection\LineResultCollection;
use cloak\result\LineResultCollectionInterface;
use cloak\result\collection\CoverageResultCollection;


describe(LineResultCollectionInterface::class, function() {
describe(FileResult::class, function() {

describe('#getRelativePath', function() {
beforeEach(function() {
Expand All @@ -35,7 +34,7 @@
$this->file = new FileResult(__DIR__ . '/../fixtures/src/foo.php', $this->lineSet);
});
it('return cloak\result\LineResultCollectionInterface instance', function() {
expect($this->file->getLineResults())->toBeAnInstanceOf(LineResultCollectionInterface::class);
expect($this->file->getLineResults())->toBeAnInstanceOf(LineResultCollection::class);
});
});
context('when line is not empty', function() {
Expand All @@ -47,7 +46,7 @@
$this->file = new FileResult(__DIR__ . '/../fixtures/src/foo.php', $this->lineSet);
});
it('should return cloak\result\LineResultCollectionInterface instance', function() {
expect($this->file->getLineResults())->toBeAnInstanceOf(LineResultCollectionInterface::class);
expect($this->file->getLineResults())->toBeAnInstanceOf(LineResultCollection::class);
});
it('should return cloak\result\LineResultCollectionInterface instance', function() {
expect($this->file->getLineResults()->getLineCount())->toEqual(2);
Expand Down
2 changes: 1 addition & 1 deletion src/result/CoverageResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ trait CoverageResult
{

/**
* @var LineResultCollectionInterface
* @var \cloak\result\collection\LineResultCollection
*/
protected $lineResults;

Expand Down
24 changes: 0 additions & 24 deletions src/result/LineResultCollectionInterface.php

This file was deleted.

13 changes: 8 additions & 5 deletions src/result/collection/LineResultCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@

namespace cloak\result\collection;

use cloak\Collection;
use cloak\collection\ElementStackable;
use cloak\value\Coverage;
use cloak\value\LineRange;
use cloak\result\LineResultCollectionInterface;
use cloak\result\LineResult;
use cloak\result\CodeCoverageResult;
use cloak\result\LineResultSelectable;
use cloak\result\LineCountResult;
use cloak\reflection\Reflection;
use PhpCollection\Sequence;

Expand All @@ -24,7 +27,7 @@
* Class LineResultCollection
* @package cloak\result\collection
*/
class LineResultCollection implements LineResultCollectionInterface
class LineResultCollection implements CodeCoverageResult, LineResultSelectable, LineCountResult, Collection
{

use ElementStackable;
Expand Down Expand Up @@ -114,7 +117,7 @@ public function isCoverageGreaterEqual(Coverage $coverage)

/**
* @param LineRange $lineRange
* @return LineResultCollectionInterface
* @return LineResultCollection
*/
public function selectRange(LineRange $lineRange)
{
Expand All @@ -128,7 +131,7 @@ public function selectRange(LineRange $lineRange)

/**
* @param Reflection $reflection
* @return LineResultCollectionInterface
* @return LineResultCollection
*/
public function selectByReflection(Reflection $reflection)
{
Expand All @@ -138,7 +141,7 @@ public function selectByReflection(Reflection $reflection)

/**
* @param array $analyzeResults
* @return LineResultCollectionInterface
* @return LineResultCollection
*/
public static function from(array $analyzeResults)
{
Expand Down

0 comments on commit bda83ec

Please sign in to comment.