Skip to content

Commit ee29f10

Browse files
committed
Add tests to check that interceptor traits cover all methods
1 parent 9f427fd commit ee29f10

File tree

2 files changed

+85
-1
lines changed

2 files changed

+85
-1
lines changed

src/Interceptor/Trait/WorkflowOutboundCallsInterceptorTrait.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ public function getVersion(GetVersionInput $input, callable $next): PromiseInter
150150
}
151151

152152
/**
153-
* @param callable(UpsertMemoInput): PromiseInterface $next
153+
* Default implementation of the `upsertMemo` method.
154+
*
155+
* @see WorkflowOutboundCallsInterceptor::upsertMemo()
154156
*/
155157
public function upsertMemo(UpsertMemoInput $input, callable $next): PromiseInterface
156158
{
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<?php
2+
3+
/**
4+
* This file is part of Temporal package.
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
10+
declare(strict_types=1);
11+
12+
namespace Temporal\Tests\Unit\Interceptor;
13+
14+
use PHPUnit\Framework\Attributes\DataProvider;
15+
use Temporal\DataConverter\DataConverter;
16+
use Temporal\DataConverter\DataConverterInterface;
17+
use Temporal\Interceptor\ActivityInboundInterceptor;
18+
use Temporal\Interceptor\Header;
19+
use Temporal\Interceptor\Trait\ActivityInboundInterceptorTrait;
20+
use Temporal\Interceptor\Trait\WorkflowClientCallsInterceptorTrait;
21+
use Temporal\Interceptor\Trait\WorkflowInboundCallsInterceptorTrait;
22+
use Temporal\Interceptor\Trait\WorkflowOutboundCallsInterceptorTrait;
23+
use Temporal\Interceptor\Trait\WorkflowOutboundRequestInterceptorTrait;
24+
use Temporal\Interceptor\WorkflowClientCallsInterceptor;
25+
use Temporal\Interceptor\WorkflowInboundCallsInterceptor;
26+
use Temporal\Interceptor\WorkflowOutboundCallsInterceptor;
27+
use Temporal\Interceptor\WorkflowOutboundRequestInterceptor;
28+
use Temporal\Tests\Unit\AbstractUnit;
29+
30+
/**
31+
* Check that interceptor traits cover all interfaces methods.
32+
*
33+
* @group unit
34+
* @group interceptor
35+
*/
36+
class TraitsTestCase extends AbstractUnit
37+
{
38+
public function testActivityInboundInterceptor(): void
39+
{
40+
new class implements ActivityInboundInterceptor {
41+
use ActivityInboundInterceptorTrait;
42+
};
43+
44+
self::assertTrue(true);
45+
}
46+
47+
public function testWorkflowClientCallsInterceptor(): void
48+
{
49+
new class implements WorkflowClientCallsInterceptor {
50+
use WorkflowClientCallsInterceptorTrait;
51+
};
52+
53+
self::assertTrue(true);
54+
}
55+
56+
public function testWorkflowInboundCallsInterceptor(): void
57+
{
58+
new class implements WorkflowInboundCallsInterceptor {
59+
use WorkflowInboundCallsInterceptorTrait;
60+
};
61+
62+
self::assertTrue(true);
63+
}
64+
65+
public function testWorkflowOutboundCallsInterceptor(): void
66+
{
67+
new class implements WorkflowOutboundCallsInterceptor {
68+
use WorkflowOutboundCallsInterceptorTrait;
69+
};
70+
71+
self::assertTrue(true);
72+
}
73+
74+
public function testWorkflowOutboundRequestInterceptor(): void
75+
{
76+
new class implements WorkflowOutboundRequestInterceptor {
77+
use WorkflowOutboundRequestInterceptorTrait;
78+
};
79+
80+
self::assertTrue(true);
81+
}
82+
}

0 commit comments

Comments
 (0)