|
4 | 4 |
|
5 | 5 | namespace Tests\Unit\Listener; |
6 | 6 |
|
| 7 | +use Hyperf\Command\Event\BeforeHandle; |
7 | 8 | use Hyperf\Contract\ConfigInterface; |
8 | 9 | use Hyperf\Contract\ContainerInterface; |
9 | 10 | use Hyperf\Coordinator\Constants; |
10 | 11 | use Hyperf\Coordinator\CoordinatorManager; |
11 | 12 | use Hyperf\Coordinator\Timer; |
12 | 13 | use Hyperf\Framework\Event\BeforeWorkerStart; |
| 14 | +use Hyperf\OpenTelemetry\Listener\MetricFlushListener; |
13 | 15 | use OpenTelemetry\SDK\Metrics\MetricReaderInterface; |
14 | 16 | use PHPUnit\Framework\TestCase; |
15 | | -use Hyperf\OpenTelemetry\Listener\MetricFlushListener; |
16 | | -use stdClass; |
17 | 17 | use Swoole\Server; |
18 | 18 |
|
19 | 19 | /** |
@@ -55,19 +55,7 @@ public function testListenReturnsCorrectEvents(): void |
55 | 55 | { |
56 | 56 | $listener = new MetricFlushListener($this->container, $this->config); |
57 | 57 |
|
58 | | - $this->assertEquals([BeforeWorkerStart::class], $listener->listen()); |
59 | | - } |
60 | | - |
61 | | - public function testProcessWithNullWorkerIdShouldDoNothing(): void |
62 | | - { |
63 | | - $event = new stdClass(); |
64 | | - $event->workerId = null; |
65 | | - |
66 | | - $this->config->expects($this->never())->method('get'); |
67 | | - $this->container->expects($this->never())->method('has'); |
68 | | - |
69 | | - $listener = new MetricFlushListener($this->container, $this->config); |
70 | | - $listener->process($event); |
| 58 | + $this->assertEquals([BeforeWorkerStart::class, BeforeHandle::class], $listener->listen()); |
71 | 59 | } |
72 | 60 |
|
73 | 61 | public function testProcessWithValidWorkerIdSetsUpTimer(): void |
|
0 commit comments