Skip to content

Commit

Permalink
PHPStan: added tests directory
Browse files Browse the repository at this point in the history
  • Loading branch information
janpecha committed Mar 13, 2023
1 parent 32c5739 commit 6905d8c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ parameters:

paths:
- src
- tests
6 changes: 4 additions & 2 deletions tests/GitPhp/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@

Tester\Environment::setup();


function test($cb)
/**
* @return void
*/
function test(callable $cb)
{
try {
$cb();
Expand Down
13 changes: 12 additions & 1 deletion tests/libs/AssertRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class AssertRunner implements \CzProject\GitPhp\IRunner
/** @var CommandProcessor */
private $commandProcessor;

/** @var array [command => RunnerResult] */
/** @var RunnerResult[] */
private $asserts = [];


Expand All @@ -30,6 +30,14 @@ public function __construct($cwd)
}


/**
* @param mixed[] $expectedArgs
* @param array<string, scalar> $expectedEnv
* @param string[] $resultOutput
* @param string[] $resultErrorOutput
* @param int $resultExitCode
* @return self
*/
public function assert(array $expectedArgs, array $expectedEnv = [], array $resultOutput = [], array $resultErrorOutput = [], $resultExitCode = 0)
{
$cmd = $this->commandProcessor->process('git', $expectedArgs, $expectedEnv);
Expand All @@ -38,6 +46,9 @@ public function assert(array $expectedArgs, array $expectedEnv = [], array $resu
}


/**
* @return self
*/
public function resetAsserts()
{
$this->asserts = [];
Expand Down

0 comments on commit 6905d8c

Please sign in to comment.