-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #204 from facile-it/fix-bad-result-handling
Fix bad result handling
- Loading branch information
Showing
4 changed files
with
86 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\Unit\Logs; | ||
|
||
use Prophecy\Argument\Token\TokenInterface; | ||
use Prophecy\Util\StringUtil; | ||
|
||
class EqualsToken implements TokenInterface, \Stringable | ||
{ | ||
private readonly StringUtil $util; | ||
|
||
private string $string; | ||
|
||
public function __construct(private readonly mixed $value, StringUtil $util = null) | ||
{ | ||
$this->util = $util ?? new StringUtil(); | ||
} | ||
|
||
/** | ||
* Scores 11 if argument matches preset value. | ||
*/ | ||
public function scoreArgument($argument): bool|int | ||
{ | ||
return $argument == $this->value ? 11 : false; | ||
} | ||
|
||
public function isLast(): bool | ||
{ | ||
return false; | ||
} | ||
|
||
/** | ||
* Returns string representation for token. | ||
*/ | ||
public function __toString(): string | ||
{ | ||
if (! isset($this->string)) { | ||
$this->string = sprintf('equals(%s)', $this->util->stringify($this->value)); | ||
} | ||
|
||
return $this->string; | ||
} | ||
} |
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