-
-
Notifications
You must be signed in to change notification settings - Fork 450
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Alex Bouma <alex@bouma.me>
- Loading branch information
1 parent
8ee5a89
commit 1f26c26
Showing
3 changed files
with
117 additions
and
46 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,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sentry\Tests\Serializer; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Sentry\Serializer\EnvelopItems\MetricsItem; | ||
|
||
final class MetricsItemTest extends TestCase | ||
{ | ||
public function testEscapeTagValues(): void | ||
{ | ||
// No escaping | ||
$this->assertSame('plain', MetricsItem::escapeTagValues('plain')); | ||
$this->assertSame('plain text', MetricsItem::escapeTagValues('plain text')); | ||
$this->assertSame('plain%text', MetricsItem::escapeTagValues('plain%text')); | ||
|
||
// Escape sequences | ||
$this->assertSame('plain \\\\\\\\ text', MetricsItem::escapeTagValues('plain \\\\ text')); | ||
$this->assertSame('plain\\u{2c}text', MetricsItem::escapeTagValues('plain,text')); | ||
$this->assertSame('plain\\u{7c}text', MetricsItem::escapeTagValues('plain|text')); | ||
$this->assertSame('plain 😅', MetricsItem::escapeTagValues('plain 😅')); | ||
|
||
// Escapable control characters | ||
$this->assertSame('plain\\\\ntext', MetricsItem::escapeTagValues("plain\ntext")); | ||
$this->assertSame('plain\\\\rtext', MetricsItem::escapeTagValues("plain\rtext")); | ||
$this->assertSame('plain\\\\ttext', MetricsItem::escapeTagValues("plain\ttext")); | ||
} | ||
} |
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