-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
275 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
namespace OckCyp\CoversValidator\Model; | ||
|
||
use PHPUnit\Util\Configuration as PHPUnit8Configuration; | ||
use PHPUnit\TextUI\Configuration\Configuration; | ||
|
||
class ConfigurationHolder | ||
{ | ||
/** | ||
* @var PHPUnit8Configuration|Configuration | ||
*/ | ||
private $configuration; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $filename; | ||
|
||
/** | ||
* @var string|null | ||
*/ | ||
private $bootstrap; | ||
|
||
/** | ||
* @param PHPUnit8Configuration|Configuration $configuration | ||
* @param string $filename | ||
* @param string|null $bootstrap | ||
*/ | ||
public function __construct($configuration, string $filename, $bootstrap) | ||
{ | ||
$this->configuration = $configuration; | ||
$this->filename = $filename; | ||
$this->bootstrap = $bootstrap; | ||
} | ||
|
||
public function getFilename(): string | ||
{ | ||
return $this->filename; | ||
} | ||
|
||
public function getConfiguration() | ||
{ | ||
return $this->configuration; | ||
} | ||
|
||
public function getBootstrap() | ||
{ | ||
return $this->bootstrap; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
|
||
namespace OckCyp\CoversValidator\Model; | ||
|
||
use PHPUnit\Util\Configuration as PHPUnit8Configuration; | ||
use PHPUnit\TextUI\Configuration\TestSuiteMapper; | ||
|
||
class TestCollection implements \Iterator | ||
{ | ||
/** | ||
* @var \Iterator | ||
*/ | ||
private $iterator; | ||
|
||
/** | ||
* @var \Iterator | ||
*/ | ||
private $iteratorIterator; | ||
|
||
public function __construct(ConfigurationHolder $configurationHolder) | ||
{ | ||
$configuration = $configurationHolder->getConfiguration(); | ||
|
||
if ($configuration instanceof PHPUnit8Configuration) { | ||
$this->iterator = $configuration->getTestSuiteConfiguration(); | ||
} else { | ||
$testSuiteMapper = new TestSuiteMapper(); | ||
|
||
$this->iterator = $testSuiteMapper->map($configuration->testSuite(), ''); | ||
} | ||
|
||
$this->iteratorIterator = new \RecursiveIteratorIterator($this->iterator); | ||
} | ||
|
||
public function current() | ||
{ | ||
return $this->iteratorIterator->current(); | ||
} | ||
|
||
public function key() | ||
{ | ||
return $this->iteratorIterator->key(); | ||
} | ||
|
||
public function next() | ||
{ | ||
$this->iteratorIterator->next(); | ||
} | ||
|
||
public function rewind() | ||
{ | ||
$this->iteratorIterator->rewind(); | ||
} | ||
|
||
public function valid(): bool | ||
{ | ||
return $this->iteratorIterator->valid(); | ||
} | ||
|
||
public function isEmpty(): bool | ||
{ | ||
return !\count($this->iterator); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.