File tree Expand file tree Collapse file tree 4 files changed +11
-11
lines changed Expand file tree Collapse file tree 4 files changed +11
-11
lines changed Original file line number Diff line number Diff line change 1212 * @method static \VoltTest\VoltTest getVoltTest()
1313 * @method static \VoltTest\Laravel\VoltTestManager addTestFromClass(string|VoltTestCase $className)
1414 * @method static Collection getScenarios() :
15- * @method static mixed run(bool $streamOutput = false)
15+ * @method static \VoltTest\TestResult run(bool $streamOutput = false)
1616 *
1717 * @see \VoltTest\Laravel\VoltTestManager
1818 */
Original file line number Diff line number Diff line change 66
77use PHPUnit \Event \Test \Finished ;
88use PHPUnit \Event \Test \FinishedSubscriber ;
9+ use VoltTest \TestResult ;
910
1011class VoltTestListener implements FinishedSubscriber
1112{
@@ -22,12 +23,8 @@ public function notify(Finished $event): void
2223 /**
2324 * Print the performance result to the console.
2425 */
25- protected function printResult (string $ testName , mixed $ result ): void
26+ protected function printResult (string $ testName , TestResult $ result ): void
2627 {
27- // Check if result has the expected methods (duck typing)
28- if (! method_exists ($ result , 'getTotalRequests ' )) {
29- return ;
30- }
3128
3229 $ output = "\n\n" ;
3330 $ output .= "---------------------------------------------------------------------- \n" ;
@@ -53,6 +50,7 @@ protected function shortenTestName(string $testName): string
5350 if (preg_match ('/::(\w+)/ ' , $ testName , $ matches )) {
5451 return $ matches [1 ];
5552 }
53+
5654 return $ testName ;
5755 }
5856}
Original file line number Diff line number Diff line change 88use VoltTest \Laravel \Contracts \VoltTestCase as VoltTestCaseInterface ;
99use VoltTest \Laravel \Facades \VoltTest ;
1010use VoltTest \Laravel \Testing \Assertions \VoltTestAssertions ;
11+ use VoltTest \TestResult ;
1112
1213/**
1314 * Base test case for VoltTest performance testing with PHPUnit.
@@ -278,7 +279,7 @@ public function createApplication()
278279 protected function runVoltTest (
279280 VoltTestCaseInterface $ testClass ,
280281 array $ options = []
281- ): mixed {
282+ ): TestResult {
282283 try {
283284 // Apply default options
284285 $ options = array_merge ([
@@ -331,7 +332,7 @@ protected function applyVoltTestOptions(array $options): void
331332 /**
332333 * Quick helper to run a simple URL load test.
333334 */
334- protected function loadTestUrl (string $ url , array $ options = []): mixed
335+ protected function loadTestUrl (string $ url , array $ options = []): TestResult
335336 {
336337 $ testClass = new class ($ url ) implements VoltTestCaseInterface {
337338 public function __construct (private string $ url )
@@ -358,7 +359,7 @@ protected function loadTestApi(
358359 string $ method = 'GET ' ,
359360 array $ data = [],
360361 array $ options = []
361- ): mixed {
362+ ): TestResult {
362363 $ testClass = new class ($ endpoint , $ method , $ data ) implements VoltTestCaseInterface {
363364 public function __construct (
364365 private string $ endpoint ,
Original file line number Diff line number Diff line change 88use Illuminate \Support \Collection ;
99use VoltTest \Laravel \Contracts \VoltTestCase ;
1010use VoltTest \Laravel \Scenarios \LaravelScenario ;
11+ use VoltTest \TestResult ;
1112use VoltTest \VoltTest ;
1213
1314class VoltTestManager
@@ -101,9 +102,9 @@ public function scenario(string $name): LaravelScenario
101102 *
102103 * @param bool $streamOutput
103104 *
104- * @return mixed
105+ * @return TestResult
105106 * */
106- public function run (bool $ streamOutput = false ): mixed
107+ public function run (bool $ streamOutput = false ): TestResult
107108 {
108109 return $ this ->voltTest ->run ($ streamOutput );
109110 }
You can’t perform that action at this time.
0 commit comments