-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Drop Prophecy in favor of PHPUnit's mocking
- Loading branch information
Showing
5 changed files
with
97 additions
and
29 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,44 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the tarantool/phpunit-extras package. | ||
* | ||
* (c) Eugene Leonovich <gen.work@gmail.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tarantool\PhpUnit\Client; | ||
|
||
use PHPUnit\Framework\Constraint\Constraint; | ||
use Tarantool\Client\Request\Request; | ||
use Tarantool\Client\RequestTypes; | ||
|
||
final class IsRequestType extends Constraint | ||
{ | ||
/** @var int */ | ||
private $requestType; | ||
|
||
public function __construct(int $requestType) | ||
{ | ||
// needed for backward compatibility with PHPUnit 7 | ||
if (\is_callable('parent::__construct')) { | ||
parent::__construct(); | ||
} | ||
|
||
$this->requestType = $requestType; | ||
} | ||
|
||
public function toString() : string | ||
{ | ||
return sprintf('is a "%s" request', strtoupper(RequestTypes::getName($this->requestType))); | ||
} | ||
|
||
protected function matches($other) : bool | ||
{ | ||
return $other instanceof Request && $other->getType() === $this->requestType; | ||
} | ||
} |
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