forked from Napp/xray-laravel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix XRay HttpSegment wrong paramters (#7)
* Fix XRay HttpSegment wrong paramters * test: Xray
- Loading branch information
1 parent
96d5634
commit 5e5279a
Showing
3 changed files
with
68 additions
and
23 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
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,45 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Napp\Xray\Tests; | ||
|
||
use Napp\Xray\Collectors\SegmentCollector; | ||
use Napp\Xray\Segments\TimeSegment; | ||
use Napp\Xray\Xray; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class XrayTest extends TestCase | ||
{ | ||
public function test_setting_end_time() | ||
{ | ||
$collector = $this->createMock(SegmentCollector::class); | ||
$segment = new TimeSegment(); | ||
|
||
$xray = new Xray($collector); | ||
|
||
$collector->expects($this->once())->method('tracer'); | ||
$collector->expects($this->once())->method('current'); | ||
$collector->expects($this->once())->method('isTracerEnabled'); | ||
$collector->expects($this->once())->method('addSegment')->with('name', null, null); | ||
$collector->expects($this->once())->method('addCustomSegment')->with($segment, 'name'); | ||
$collector->expects($this->once())->method('addHttpSegment')->with('url', []); | ||
$collector->expects($this->once())->method('getSegment')->with('name'); | ||
$collector->expects($this->once())->method('endSegment')->with('name'); | ||
$collector->expects($this->once())->method('endHttpSegment')->with('name'); | ||
$collector->expects($this->once())->method('hasAddedSegment')->with('name'); | ||
$collector->expects($this->once())->method('endCurrentSegment'); | ||
|
||
$xray->tracer(); | ||
$xray->current(); | ||
$xray->isEnabled(); | ||
$xray->addSegment('name'); | ||
$xray->addCustomSegment($segment, 'name'); | ||
$xray->addHttpSegment('url'); | ||
$xray->getSegment('name'); | ||
$xray->endSegment('name'); | ||
$xray->endHttpSegment('name'); | ||
$xray->hasAddedSegment('name'); | ||
$xray->endCurrentSegment(); | ||
} | ||
} |