Skip to content

Commit

Permalink
add test for PhpSearcherContext
Browse files Browse the repository at this point in the history
  • Loading branch information
sj-i committed Jul 31, 2020
1 parent b1d50cb commit cdfdd1d
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions tests/Inspector/Daemon/Searcher/Context/PhpSearcherContextTest.php
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());
}
}

0 comments on commit cdfdd1d

Please sign in to comment.