Skip to content

Commit

Permalink
Merge branch 'v8.x' into hide-full-coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
nunomaduro authored Jan 23, 2025
2 parents cc05e7e + 940a4f4 commit c144384
Show file tree
Hide file tree
Showing 17 changed files with 96 additions and 59 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
php: ['8.2', '8.3']
pest: ['2.30', '3.0.0']
php: ['8.2', '8.3', '8.4']
pest: ['3.7.2']
dependency-version: [prefer-lowest, prefer-stable]

name: PHP ${{ matrix.php }} - ${{ matrix.os }} - Pest ${{ matrix.pest }} - ${{ matrix.dependency-version }}

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ composer require nunomaduro/collision --dev
10.x | 7.x | 10.x | 2.x
11.x | 8.x | 10.x | 2.x
11.x | 8.x | 11.x | 3.x
12.x | 8.x | 11.x | 3.x

As an example, here is how to require Collision on Laravel 8.x:

Expand Down
28 changes: 14 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "nunomaduro/collision",
"description": "Cli error handling for console/command-line PHP applications.",
"keywords": ["console", "command-line", "php", "cli", "error", "handling", "laravel-zero", "laravel", "artisan", "symfony"],
"keywords": ["console", "command-line", "php", "cli", "error", "handling", "laravel-zero", "laravel", "artisan", "symfony", "dev"],
"license": "MIT",
"support": {
"issues": "https://github.com/nunomaduro/collision/issues",
Expand All @@ -15,23 +15,23 @@
],
"require": {
"php": "^8.2.0",
"filp/whoops": "^2.15.4",
"nunomaduro/termwind": "^2.1.0",
"symfony/console": "^7.1.4"
"filp/whoops": "^2.16.0",
"nunomaduro/termwind": "^2.3.0",
"symfony/console": "^7.2.1"
},
"conflict": {
"laravel/framework": "<11.0.0 || >=12.0.0",
"phpunit/phpunit": "<10.5.1 || >=12.0.0"
"laravel/framework": "<11.39.1 || >=13.0.0",
"phpunit/phpunit": "<11.5.3 || >=12.0.0"
},
"require-dev": {
"laravel/framework": "^11.23.5",
"laravel/pint": "^1.17.3",
"laravel/tinker": "^2.9.0",
"laravel/sail": "^1.32.0",
"laravel/sanctum": "^4.0.2",
"larastan/larastan": "^2.9.8",
"orchestra/testbench-core": "^9.4.1",
"pestphp/pest": "^2.35.0 || ^3.0.8",
"laravel/framework": "^11.39.1",
"laravel/pint": "^1.20.0",
"laravel/tinker": "^2.10.0",
"laravel/sail": "^1.40.0",
"laravel/sanctum": "^4.0.7",
"larastan/larastan": "^2.9.12",
"orchestra/testbench-core": "^9.9.2",
"pestphp/pest": "^3.7.3",
"sebastian/environment": "^6.1.0 || ^7.2.0"
},
"autoload-dev": {
Expand Down
4 changes: 4 additions & 0 deletions src/Adapters/Laravel/Commands/TestCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,10 @@ protected function phpunitArguments($options)
&& ! Str::startsWith($option, '--min');
}));

if (!empty(preg_grep('/^--configuration=|-c/', $options))) {
return array_merge($this->commonArguments(), $options);
}

return array_merge($this->commonArguments(), ['--configuration='.$this->getConfigurationFile()], $options);
}

Expand Down
11 changes: 11 additions & 0 deletions src/Adapters/Phpunit/Style.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use PHPUnit\Framework\ExpectationFailedException;
use PHPUnit\Framework\IncompleteTestError;
use PHPUnit\Framework\SkippedWithMessageException;
use PHPUnit\Runner\TestSuiteSorter;
use PHPUnit\TestRunner\TestResult\TestResult as PHPUnitTestResult;
use PHPUnit\TextUI\Configuration\Registry;
use ReflectionClass;
Expand Down Expand Up @@ -268,6 +269,16 @@ public function writeRecap(State $state, Info $telemetry, PHPUnitTestResult $res
),
]);

$configuration = Registry::get();
if ($configuration->executionOrder() === TestSuiteSorter::ORDER_RANDOMIZED) {
$this->output->writeln([
sprintf(
' <fg=gray>Random Order Seed:</> <fg=default>%s</>',
$configuration->randomOrderSeed(),
),
]);
}

$this->output->writeln('');
}

Expand Down
2 changes: 1 addition & 1 deletion tests/LaravelApp/tests/Feature/CoverageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#[Group('coverage')]
class CoverageTest extends TestCase
{
public function testExample()
public function test_example()
{
$this->assertTrue(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class EnvironmentCustomVariablesTest extends TestCase
{
#[Group('environmentNoCVPhpunit')]
public function testEnvironmentNoCustomVariablesPhpunit()
public function test_environment_no_custom_variables_phpunit()
{
$this->assertEquals(null, env('LARAVEL_PARALLEL_TESTING'));
$this->assertEquals(null, env('LARAVEL_PARALLEL_TESTING_RECREATE_DATABASES'));
Expand All @@ -21,7 +21,7 @@ public function testEnvironmentNoCustomVariablesPhpunit()
}

#[Group('environmentNoCVParallel')]
public function testEnvironmentNoCustomVariablesParallel()
public function test_environment_no_custom_variables_parallel()
{
$this->assertEquals(1, env('LARAVEL_PARALLEL_TESTING'));
$this->assertEquals(null, env('LARAVEL_PARALLEL_TESTING_RECREATE_DATABASES'));
Expand All @@ -31,7 +31,7 @@ public function testEnvironmentNoCustomVariablesParallel()
}

#[Group('environmentNoCVParallelRecreate')]
public function testEnvironmentNoCustomVariablesParallelWithRecreate()
public function test_environment_no_custom_variables_parallel_with_recreate()
{
$this->assertEquals(1, env('LARAVEL_PARALLEL_TESTING'));
$this->assertEquals(1, env('LARAVEL_PARALLEL_TESTING_RECREATE_DATABASES'));
Expand All @@ -42,7 +42,7 @@ public function testEnvironmentNoCustomVariablesParallelWithRecreate()
}

#[Group('environmentNoCVParallelDrop')]
public function testEnvironmentNoCustomVariablesParallelWithDrop()
public function test_environment_no_custom_variables_parallel_with_drop()
{
$this->assertEquals(1, env('LARAVEL_PARALLEL_TESTING'));
$this->assertEquals(1, env('LARAVEL_PARALLEL_TESTING_DROP_DATABASES'));
Expand All @@ -53,7 +53,7 @@ public function testEnvironmentNoCustomVariablesParallelWithDrop()
}

#[Group('environmentCVPhpunit')]
public function testEnvironmentCustomVariablesPhpunit()
public function test_environment_custom_variables_phpunit()
{
$this->assertEquals(null, env('LARAVEL_PARALLEL_TESTING'));
$this->assertEquals(null, env('LARAVEL_PARALLEL_TESTING_RECREATE_DATABASES'));
Expand All @@ -63,7 +63,7 @@ public function testEnvironmentCustomVariablesPhpunit()
}

#[Group('environmentCVParallel')]
public function testEnvironmentCustomVariablesParallel()
public function test_environment_custom_variables_parallel()
{
$this->assertEquals(1, env('LARAVEL_PARALLEL_TESTING'));
$this->assertEquals(null, env('LARAVEL_PARALLEL_TESTING_RECREATE_DATABASES'));
Expand All @@ -73,7 +73,7 @@ public function testEnvironmentCustomVariablesParallel()
}

#[Group('environmentCVParallelRecreate')]
public function testEnvironmentCustomVariablesParallelWithRecreate()
public function test_environment_custom_variables_parallel_with_recreate()
{
$this->assertEquals(1, env('LARAVEL_PARALLEL_TESTING'));
$this->assertEquals(1, env('LARAVEL_PARALLEL_TESTING_RECREATE_DATABASES'));
Expand All @@ -84,7 +84,7 @@ public function testEnvironmentCustomVariablesParallelWithRecreate()
}

#[Group('environmentCVParallelDrop')]
public function testEnvironmentCustomVariablesParallelWithDrop()
public function test_environment_custom_variables_parallel_with_drop()
{
$this->assertEquals(1, env('LARAVEL_PARALLEL_TESTING'));
$this->assertEquals(1, env('CUSTOM_ENV_VARIABLE'));
Expand Down
10 changes: 5 additions & 5 deletions tests/LaravelApp/tests/Feature/ExampleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,29 @@

class ExampleTest extends TestCase
{
public function testSkippedExample()
public function test_skipped_example()
{
$this->markTestSkipped('This is a skip description');
}

public function testIncompleteExample()
public function test_incomplete_example()
{
$this->markTestIncomplete('This is a incomplete description');
}

public function testRiskyExample()
public function test_risky_example()
{
// ..
}

public function testDeprecationExample()
public function test_deprecation_example()
{
trigger_deprecation('foo', '1.0', 'This is a deprecation description');

$this->assertTrue(true);
}

public function testPassExample()
public function test_pass_example()
{
static::assertTrue(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static function getLatestPrintableTestCaseMethodName(): string
}

#[Group('custom-name')]
public function testPassExample()
public function test_pass_example()
{
$this->assertTrue(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class ExampleWithUnexpectedOutputTest extends TestCase
{
#[Group('unexpected-output')]
public function testPassExample()
public function test_pass_example()
{
echo 'This is an unexpected output';

Expand Down
18 changes: 9 additions & 9 deletions tests/LaravelApp/tests/Unit/ExampleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,64 +10,64 @@
class ExampleTest extends TestCase
{
#[Group('fail')]
public function testFailExample()
public function test_fail_example()
{
$this->assertFalse(true);
}

#[Group('todo')]
public function testTodoExample()
public function test_todo_example()
{
$this->markTestSkipped('__TODO__');
}

public function testBasicTest()
public function test_basic_test()
{
$this->assertTrue(true);
}

#[Group('notices')]
public function testUserNotice()
public function test_user_notice()
{
trigger_error('This is a user notice');

$this->assertTrue(true);
}

#[Group('notices')]
public function testUserNoticeTwo()
public function test_user_notice_two()
{
trigger_error('This is another user notice');

$this->assertTrue(true);
}

#[Group('warnings')]
public function testWarning()
public function test_warning()
{
$this->blabla;

$this->assertTrue(true);
}

#[Group('warnings')]
public function testUserWarning()
public function test_user_warning()
{
trigger_error('This is a user warning', E_USER_WARNING);

$this->assertTrue(true);
}

#[Group('deprecations')]
public function testDeprecation()
public function test_deprecation()
{
str_contains(null, null);

$this->assertTrue(true);
}

#[Group('deprecations')]
public function testUserDeprecation()
public function test_user_deprecation()
{
trigger_deprecation('foo', '1.0', 'This is a deprecation description');

Expand Down
2 changes: 1 addition & 1 deletion tests/Printer/DatasetsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static function provideData(): array
}

#[DataProvider('provideData')]
public function testWithOutput(string $data)
public function test_with_output(string $data)
{
echo $data;

Expand Down
6 changes: 3 additions & 3 deletions tests/TestCaseWithStdoutOutput/OutputTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@

class OutputTest extends TestCase
{
public function testWithOutput()
public function test_with_output()
{
echo 'Foo';

$this->assertTrue(true);
}

public function testNothingSpecial()
public function test_nothing_special()
{
// This shouldn't have any output
$this->assertTrue(true);
}

public function testWithNoOutput()
public function test_with_no_output()
{
$this->expectOutputRegex('/Bar/');

Expand Down
Loading

0 comments on commit c144384

Please sign in to comment.