Skip to content

Commit

Permalink
chore: format
Browse files Browse the repository at this point in the history
  • Loading branch information
byawitz committed Sep 5, 2024
1 parent db50ac2 commit 32b778f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
10 changes: 5 additions & 5 deletions src/Platform/Platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,18 @@ public function init(string $type, array $params = []): void
case Service::TYPE_HTTP:
$this->initHttp($services);
break;
case Service::TYPE_TASK:
$adapter = $params['adapter'] ?? new Generic();
$this->cli ??= new CLI($adapter);
$this->initTasks($services);
case Service::TYPE_TASK:
$adapter = $params['adapter'] ?? new Generic();
$this->cli ??= new CLI($adapter);
$this->initTasks($services);
break;
case Service::TYPE_GRAPHQL:
$this->initGraphQL();
break;
case Service::TYPE_WORKER:
$workerName = $params['workerName'] ?? null;

if (!isset($this->worker)) {
if (! isset($this->worker)) {
$connection = $params['connection'] ?? null;
$workersNum = $params['workersNum'] ?? 0;
$workerName = $params['workerName'] ?? null;
Expand Down
1 change: 1 addition & 0 deletions tests/Platform/MockResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public function write(string $content): bool
if (! is_null($content)) {
echo $content;
}

return true;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/CLITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function testCLISetup()
{
ob_start();

$cli = new CLI( new Generic(),['test.php', 'build', '[email protected]', '--list=item1', '--list=item2']); // Mock command request
$cli = new CLI(new Generic(), ['test.php', 'build', '[email protected]', '--list=item1', '--list=item2']); // Mock command request

$platform = new TestPlatform();
$platform->setCli($cli);
Expand Down
21 changes: 10 additions & 11 deletions tests/e2e/HTTPServicesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ public function testRootAction()
$_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['REQUEST_URI'] = '/';


$context = new Container();
$context->set( (new Dependency())->setName('response')->setCallback(fn () => new MockResponse()));
$context->set( (new Dependency())->setName('request')->setCallback(fn () => new Request()));
$context->set((new Dependency())->setName('response')->setCallback(fn () => new MockResponse()));
$context->set((new Dependency())->setName('request')->setCallback(fn () => new Request()));

\ob_start();
$this->http->run($context);
Expand All @@ -60,8 +59,8 @@ public function testChunkedAction()

$res = new MockResponse();
$context = new Container();
$context->set( (new Dependency())->setName('response')->setCallback(fn () => $res));
$context->set( (new Dependency())->setName('request')->setCallback(fn () => new Request()));
$context->set((new Dependency())->setName('response')->setCallback(fn () => $res));
$context->set((new Dependency())->setName('request')->setCallback(fn () => new Request()));

\ob_start();
$this->http->run($context);
Expand All @@ -78,8 +77,8 @@ public function testRedirectAction()

$res = new MockResponse();
$context = new Container();
$context->set( (new Dependency())->setName('response')->setCallback(fn () => $res));
$context->set( (new Dependency())->setName('request')->setCallback(fn () => new Request()));
$context->set((new Dependency())->setName('response')->setCallback(fn () => $res));
$context->set((new Dependency())->setName('request')->setCallback(fn () => new Request()));

$this->http->run($context);

Expand All @@ -93,8 +92,8 @@ public function testHook()

$res = new MockResponse();
$context = new Container();
$context->set( (new Dependency())->setName('response')->setCallback(fn () => $res));
$context->set( (new Dependency())->setName('request')->setCallback(fn () => new Request()));
$context->set((new Dependency())->setName('response')->setCallback(fn () => $res));
$context->set((new Dependency())->setName('request')->setCallback(fn () => new Request()));

\ob_start();
$this->http->run($context);
Expand All @@ -109,8 +108,8 @@ public function testHook()

$res1 = new MockResponse();
$context = new Container();
$context->set( (new Dependency())->setName('response')->setCallback(fn () => $res1));
$context->set( (new Dependency())->setName('request')->setCallback(fn () => new Request()));
$context->set((new Dependency())->setName('response')->setCallback(fn () => $res1));
$context->set((new Dependency())->setName('request')->setCallback(fn () => new Request()));

\ob_start();
$this->http->run($context);
Expand Down

0 comments on commit 32b778f

Please sign in to comment.