Skip to content

Commit

Permalink
test: Rename method and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lee-to committed May 27, 2024
1 parent 873bb16 commit 26a08ea
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Client/TrapHandle.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,13 @@ public function context(mixed ...$values): self
return $this;
}

public function highlight(string $language): self
/**
* Code highlighting.
* Will call the context method{@see context()} and pass the language parameter
*/
public function code(string $syntax): self
{
return $this->context(language: $language);
return $this->context(language: $syntax);
}

public function __destruct()
Expand Down
7 changes: 7 additions & 0 deletions tests/Unit/Client/TrapTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ public function testContextMultiple(): void
self::assertSame(['foo' => 'new', 'bar' => 'bar-context'], self::$lastData->getContext());
}

public function testCodeHighlight(): void
{
trap('test-value')->code('php');

self::assertSame(['language' => 'php'], self::$lastData->getContext());
}

/**
* Check the first line of dumped stacktrace string contains right file and line.
*/
Expand Down

0 comments on commit 26a08ea

Please sign in to comment.