This repository has been archived by the owner on Jul 13, 2023. It is now read-only.
forked from hyperf/tracer
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CORE-909] Evita que uma barra no final seja adicionada depois da más…
- Loading branch information
1 parent
ce1c6a2
commit 76d8c1a
Showing
2 changed files
with
45 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* This file is part of Hyperf + PicPay. | ||
* | ||
* @link https://github.com/PicPay/hyperf-tracer | ||
* @document https://github.com/PicPay/hyperf-tracer/wiki | ||
* @contact @PicPay | ||
* @license https://github.com/PicPay/hyperf-tracer/blob/main/LICENSE | ||
*/ | ||
namespace HyperfTest\Tracer\Aspect; | ||
|
||
use Hyperf\Tracer\Aspect\HttpClientAspect; | ||
use Hyperf\Tracer\SpanTagManager; | ||
use Hyperf\Tracer\SwitchManager; | ||
use Mockery; | ||
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration; | ||
use OpenTracing\Tracer; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
final class HttpClientAspectTest extends TestCase | ||
{ | ||
use MockeryPHPUnitIntegration; | ||
|
||
public function testClearUri(): void | ||
{ | ||
$aspect = new HttpClientAspect( | ||
Mockery::spy(Tracer::class), | ||
Mockery::spy(SwitchManager::class), | ||
Mockery::spy(SpanTagManager::class), | ||
); | ||
|
||
self::assertSame('/v1/test', $aspect->clearUri('/v1/test')); | ||
self::assertSame('/v2/test/<NUMBER>', $aspect->clearUri('/v2/test/123')); | ||
self::assertSame('/v3/test/<NUMBER>/bar', $aspect->clearUri('/v3/test/123/bar')); | ||
self::assertSame('/v4/test/<NUMBER>/bar/<NUMBER>/', $aspect->clearUri('/v4/test/123/bar/456/')); | ||
} | ||
} |