FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

MercerMorning/codeception-grpc-module: codeception-grpc-module · GitHub

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Codeception gRPC Module

This module allows you to write functional tests for gRPC services using Codeception. It provides tools for sending gRPC requests and asserting responses, which helps ensure your gRPC services behave as expected.

Features

  • Send gRPC requests using any gRPC service client.
  • Validate responses using familiar Codeception assertions.
  • Supports fixtures and integration with your DI container (e.g. Symfony).

Installation

composer require --dev mercer_morning/codeception-grpc-module

Configuration

Add the module to your suite configuration file (e.g., tests/functional.suite.yml):

modules:
  enabled:
    - Codeception\Module\Grpc

Usage

Here’s an example of how to use the module in a test:

<?php

use App\Grpc\CalendarService;
use App\Tests\Fixtures\CalendarFixture;
use Codeception\Example;
use YourNamespace\Proto\GetEmployeesWithWorkingDaysInRangeRequest;
use YourNamespace\Proto\GetEmployeesWithWorkingDaysInRangeResponse;

$request = new GetEmployeesWithWorkingDaysInRangeRequest();
$request->setBranchUuid('d43040e0-96ea-4d9f-9fc9-020ee933536b');

/** @var GetEmployeesWithWorkingDaysInRangeResponse $res */
$res = $I->doGrpcRequest(
    $I->grabService(CalendarService::class), 
    'GetEmployeesWithWorkingDaysInRange', 
    $request
);

$uuids = [];
foreach ($res->getUuids() as $uuid) {
    $uuids[] = $uuid;
}

$I->assertEquals([
    "dbf4de2e-c342-4c52-b95d-ecd8f7a492f1",
    "dbf4de2e-c342-4c52-b95d-ecd8f7a492f2"
], $uuids);

Methods

doGrpcRequest($service, string $method, Message $request): Message

Sends a gRPC request to the specified service using the given method and request object. Returns the response object.

About

codeception-grpc-module

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages


Back | FazBrowse Home | New Git URL