-
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.
- Loading branch information
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
tests/Inspector/Daemon/Searcher/Context/PhpSearcherContextTest.php
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,53 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the sj-i/php-profiler package. | ||
* | ||
* (c) sji <sji@sj-i.dev> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PhpProfiler\Inspector\Daemon\Searcher\Context; | ||
|
||
use Amp\Parallel\Context\Context; | ||
use Amp\Promise; | ||
use Mockery; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class PhpSearcherContextTest extends TestCase | ||
{ | ||
public function testStart(): void | ||
{ | ||
$context = Mockery::mock(Context::class); | ||
$context->expects()->start()->andReturn(Mockery::mock(Promise::class)); | ||
$php_searcher_context = new PhpSearcherContext($context); | ||
$this->assertInstanceOf(Promise::class, $php_searcher_context->start()); | ||
} | ||
|
||
public function testSendTargetRegex(): void | ||
{ | ||
|
||
$context = Mockery::mock(Context::class); | ||
$context->shouldReceive('send') | ||
->once() | ||
->with('abcdefg') | ||
->andReturn(Mockery::mock(Promise::class)); | ||
$php_searcher_context = new PhpSearcherContext($context); | ||
$this->assertInstanceOf( | ||
Promise::class, | ||
$php_searcher_context->sendTargetRegex('abcdefg') | ||
); | ||
} | ||
|
||
public function testReceivePidList(): void | ||
{ | ||
$context = Mockery::mock(Context::class); | ||
$context->expects()->receive()->andReturn(Mockery::mock(Promise::class)); | ||
$php_searcher_context = new PhpSearcherContext($context); | ||
$this->assertInstanceOf(Promise::class, $php_searcher_context->receivePidList()); | ||
} | ||
} |