You've already forked Php-Template
All checks were successful
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 2m40s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 2m42s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 2m53s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 2m55s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 2m42s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 1m24s
37 lines
966 B
PHP
37 lines
966 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Siteworxpro\Tests\GrpcHandlers;
|
|
|
|
use GRPC\Greeter\HelloRequest;
|
|
use League\Tactician\CommandBus;
|
|
use Siteworxpro\App\GrpcHandlers\GreeterHandler;
|
|
use Siteworxpro\Tests\Unit;
|
|
use Spiral\RoadRunner\GRPC\ContextInterface;
|
|
|
|
class GreeterHandlerTest extends Unit
|
|
{
|
|
/**
|
|
* @throws \ReflectionException
|
|
*/
|
|
public function testSayHello(): void
|
|
{
|
|
$this->getContainer()->bind(CommandBus::class, function () {
|
|
return \Mockery::mock(CommandBus::class)
|
|
->shouldReceive('handle')
|
|
->andReturn('Hello World')
|
|
->getMock();
|
|
});
|
|
|
|
$request = new HelloRequest();
|
|
$request->setName('World');
|
|
|
|
$context = \Mockery::mock(ContextInterface::class);
|
|
|
|
$handler = new GreeterHandler();
|
|
$response = $handler->SayHello($context, $request);
|
|
$this->assertEquals('Hello World', $response->getMessage());
|
|
}
|
|
}
|