Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/2.0' into feature/discord
Browse files Browse the repository at this point in the history
# Conflicts:
#	README.md
  • Loading branch information
meekstellar committed Nov 17, 2022
2 parents 57c6af6 + 6099e97 commit e651d26
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

[Temporal](https://temporal.io/) is the simple, scalable open source way to write and run reliable cloud applications.

## Temporal screencasts
[<img src="https://i.imgur.com/HfO3yzk.png">](https://youtu.be/goulj2CRNOY)

## Requirements

Make sure that your server is configured with following PHP version and extensions:
Expand Down
23 changes: 23 additions & 0 deletions src/Bootloader/PrototypeBootloader.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

namespace Spiral\TemporalBridge\Bootloader;

use Spiral\Boot\Bootloader\Bootloader;
use Spiral\Prototype\Bootloader\PrototypeBootloader as BasePrototypeBootloader;
use Spiral\TemporalBridge\WorkflowManagerInterface;
use Temporal\Client\WorkflowClientInterface;

class PrototypeBootloader extends Bootloader
{
protected const DEPENDENCIES = [
BasePrototypeBootloader::class,
];

public function boot(BasePrototypeBootloader $prototype): void
{
$prototype->bindProperty('workflow', WorkflowClientInterface::class);
$prototype->bindProperty('workflowManager', WorkflowManagerInterface::class);
}
}
30 changes: 30 additions & 0 deletions tests/src/Bootloader/PrototypeBootloaderTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

declare(strict_types=1);

namespace Spiral\TemporalBridge\Tests\Bootloader;

use Spiral\Prototype\PrototypeRegistry;
use Spiral\TemporalBridge\Tests\TestCase;
use Spiral\TemporalBridge\WorkflowManagerInterface;
use Temporal\Client\WorkflowClientInterface;

class PrototypeBootloaderTest extends TestCase
{
/** @dataProvider propertiesDataProvider */
public function testBindProperties(string $expected, string $property): void
{
$registry = $this->getContainer()->get(PrototypeRegistry::class);

$this->assertInstanceOf(
$expected,
$this->getContainer()->get($registry->resolveProperty($property)->type->name())
);
}

public function propertiesDataProvider(): \Traversable
{
yield [WorkflowClientInterface::class, 'workflow'];
yield [WorkflowManagerInterface::class, 'workflowManager'];
}
}
1 change: 1 addition & 0 deletions tests/src/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public function defineBootloaders(): array
\Spiral\Boot\Bootloader\ConfigurationBootloader::class,
\Spiral\Bootloader\Attributes\AttributesBootloader::class,
\Spiral\TemporalBridge\Bootloader\TemporalBridgeBootloader::class,
\Spiral\TemporalBridge\Bootloader\PrototypeBootloader::class,
// ...
];
}
Expand Down

0 comments on commit e651d26

Please sign in to comment.