Skip to content

Commit 52c47f1

Browse files
authored
Merge pull request #26 from jamesthomasonjr/path-branch-coverage-abstract-node
Add branch path support to abstract node
2 parents f3714ff + ce23286 commit 52c47f1

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

src/Node/AbstractNode.php

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,34 @@ public function getTestedMethodsPercent(bool $asString = true)
180180
);
181181
}
182182

183+
/**
184+
* Returns the percentage of paths that have been tested.
185+
*
186+
* @return int|string
187+
*/
188+
public function getTestedPathsPercent(bool $asString = true)
189+
{
190+
return Util::percent(
191+
$this->getNumTestedPaths(),
192+
$this->getNumPaths(),
193+
$asString
194+
);
195+
}
196+
197+
/**
198+
* Returns the percentage of branches that have been tested.
199+
*
200+
* @return int|string
201+
*/
202+
public function getTestedBranchesPercent(bool $asString = true)
203+
{
204+
return Util::percent(
205+
$this->getNumTestedBranches(),
206+
$this->getNumBranches(),
207+
$asString
208+
);
209+
}
210+
183211
/**
184212
* Returns the percentage of functions and methods that has been tested.
185213
*
@@ -276,6 +304,16 @@ abstract public function getFunctions(): array;
276304
*/
277305
abstract public function getLinesOfCode(): array;
278306

307+
/**
308+
* Returns the paths of this node.
309+
*/
310+
abstract public function getPaths(): array;
311+
312+
/**
313+
* Returns the branches of this node.
314+
*/
315+
abstract public function getBranches(): array;
316+
279317
/**
280318
* Returns the number of executable lines.
281319
*/
@@ -325,4 +363,24 @@ abstract public function getNumFunctions(): int;
325363
* Returns the number of tested functions.
326364
*/
327365
abstract public function getNumTestedFunctions(): int;
366+
367+
/**
368+
* Returns the number of paths.
369+
*/
370+
abstract public function getNumPaths(): int;
371+
372+
/**
373+
* Returns the number of tested paths.
374+
*/
375+
abstract public function getNumTestedPaths(): int;
376+
377+
/**
378+
* Returns the number of branches.
379+
*/
380+
abstract public function getNumBranches(): int;
381+
382+
/**
383+
* Returns the number of tested branches.
384+
*/
385+
abstract public function getNumTestedBranches(): int;
328386
}

0 commit comments

Comments
 (0)