for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Spiral Framework.
*
* @license MIT
* @author Anton Titov (Wolfy-J)
*/
declare(strict_types=1);
namespace Spiral\Framework\GRPC;
use Spiral\Files\Files;
use Spiral\Framework\ConsoleTest;
class ListTest extends ConsoleTest
{
private $proto;
public function setUp()
parent::setUp();
$fs = new Files();
$this->proto = $fs->normalizePath($this->app->dir('app') . 'proto/service.proto');
// protoc can't figure relative paths
$this->proto = str_replace('Framework/../', '', $this->proto);
}
public function tearDown()
parent::tearDown();
if ($fs->isDirectory($this->app->dir('app') . 'src/Service')) {
$fs->deleteDirectory($this->app->dir('app') . 'src/Service');
if ($fs->isDirectory($this->app->dir('app') . 'src/GPBMetadata')) {
$fs->deleteDirectory($this->app->dir('app') . 'src/GPBMetadata');
public function testListEmpty()
$out = $this->runCommandDebug('grpc:services');
$this->assertContains('No GRPC services', $out);
public function testListService()
$this->runCommandDebug('grpc:generate', [
'proto' => $this->proto
]);
file_put_contents($this->app->dir('app') . 'src/Service/EchoService.php', GenerateTest::SERVICE);
$this->assertContains('service.Echo', $out);
$this->assertContains('Spiral\App\Service\EchoService', $out);