Skip to content

Commit 5bff1e8

Browse files
[8.x] Adds Pest 3 support (#1141)
* Adds Pest 3 support * Apply fixes from StyleCI * Update InstallCommand.php * Update InstallCommand.php --------- Co-authored-by: StyleCI Bot <[email protected]>
1 parent 5c6784a commit 5bff1e8

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

src/Console/InstallCommand.php

+18-8
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,24 @@ public function handle()
6464

6565
$contents = file_get_contents(base_path('tests/Pest.php'));
6666

67-
$contents = str_replace('<?php', <<<EOT
68-
<?php
69-
70-
uses(
71-
Tests\DuskTestCase::class,
72-
// Illuminate\Foundation\Testing\DatabaseMigrations::class,
73-
)->in('Browser');
74-
EOT, $contents);
67+
if (str_contains($contents, 'uses(')) {
68+
$contents = str_replace('<?php', <<<EOT
69+
<?php
70+
71+
uses(
72+
Tests\DuskTestCase::class,
73+
// Illuminate\Foundation\Testing\DatabaseMigrations::class,
74+
)->in('Browser');
75+
EOT, $contents);
76+
} else {
77+
$contents = str_replace('<?php', <<<EOT
78+
<?php
79+
80+
pest()->extend(Tests\DuskTestCase::class)
81+
// ->use(Illuminate\Foundation\Testing\DatabaseMigrations::class)
82+
->in('Browser');
83+
EOT, $contents);
84+
}
7585

7686
file_put_contents(base_path('tests/Pest.php'), $contents);
7787
} else {

0 commit comments

Comments
 (0)