Skip to content

Commit c0f19d6

Browse files
committed
Improve PHPUnit helper methods
1 parent 3e929c9 commit c0f19d6

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

docs/index.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,25 +104,24 @@ Target: Foobar\Baz\MyEnum::test; Path: /path/to/profiling/code.php; Iterations:
104104
A **fluent, unit-aware PHPUnit helper** for asserting profiler metrics.
105105

106106
```php
107-
use Bakame\Stackwatch\Test\MetricsAssertions;
107+
use Bakame\Stackwatch\Test\PerformanceAssertions;
108108
use PHPUnit\Framework\Attributes\Test;
109109
use PHPUnit\Framework\TestCase;
110110

111111
final class ExampleTest extends TestCase
112112
{
113-
use MetricsAssertions;
113+
use PerformanceAssertions;
114114

115115
#[Test]
116116
public function it_can_test_callback_performance(): void
117117
{
118118
$performance = $this
119-
->iter(5)
119+
->iterations(5)
120120
->warmup(2)
121-
->aggMedian()
122-
->assertMetrics($service->calculateHeavyStuff(...));
123-
124-
$performance->executionTime()->lessThan(200, 'milliseconds')
125-
$performance->memoryUsage()->greaterThan(10, 'mb');
121+
->assertPerformance($service->calculateHeavyStuff(...));
122+
123+
$performance->median()->executionTime()->lessThan(200, 'milliseconds')
124+
$performance->range()->memoryUsage()->greaterThan(10, 'mb');
126125
}
127126
}
128127
```

0 commit comments

Comments
 (0)