Skip to content

Commit

Permalink
[tests] Make test more robust
Browse files Browse the repository at this point in the history
Reduce use of magic values
  • Loading branch information
sunkan committed Feb 15, 2022
1 parent a9c7db3 commit e24667f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/Handler/BugsnagHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class BugsnagHandlerTest extends TestCase
{
/** @var Client|\PHPUnit\Framework\MockObject\MockObject */
/** @var Client&\PHPUnit\Framework\MockObject\MockObject */
private $client;

protected function setUp(): void
Expand Down Expand Up @@ -54,11 +54,11 @@ public function testEmptyFilterNamespaces(): void
$handler = new BugsnagHandler($this->client);
$handler->setFilter([]);

$this->assertCount(11, $report->getStacktrace()->getFrames());
$frameCount = count($report->getStacktrace()->getFrames());

$handler->cleanStacktrace($report);

$this->assertCount(11, $report->getStacktrace()->getFrames());
$this->assertCount($frameCount, $report->getStacktrace()->getFrames());
}

public function testNoneExistingNamespaceFilter(): void
Expand All @@ -68,11 +68,11 @@ public function testNoneExistingNamespaceFilter(): void
$handler = new BugsnagHandler($this->client);
$handler->setFilter(['Sunkan\\']);

$this->assertCount(11, $report->getStacktrace()->getFrames());
$frameCount = count($report->getStacktrace()->getFrames());

$handler->cleanStacktrace($report);

$this->assertCount(11, $report->getStacktrace()->getFrames());
$this->assertCount($frameCount, $report->getStacktrace()->getFrames());
}

public function testFilterNamespaces(): void
Expand All @@ -82,11 +82,11 @@ public function testFilterNamespaces(): void
$handler = new BugsnagHandler($this->client);
$handler->setFilter(['PHPUnit\\']);

$this->assertCount(11, $report->getStacktrace()->getFrames());
$frameCount = count($report->getStacktrace()->getFrames());

$handler->cleanStacktrace($report);

$this->assertCount(2, $report->getStacktrace()->getFrames());
$this->assertCount($frameCount - 9, $report->getStacktrace()->getFrames());
}

public function testIncludeContext(): void
Expand Down

0 comments on commit e24667f

Please sign in to comment.