Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not Suppress Warnings (v8.x) #324

Open
wants to merge 1 commit into
base: v8.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/Adapters/Phpunit/Printers/DefaultPrinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,7 @@ public function testRunnerDeprecationTriggered(TestRunnerDeprecationTriggered $e
*/
public function testRunnerWarningTriggered(TestRunnerWarningTriggered $event): void
{
if (! str_starts_with($event->message(), 'No tests found in class')) {
$this->style->writeWarning($event->message());
}
$this->style->writeWarning($event->message());
}

/**
Expand Down
10 changes: 10 additions & 0 deletions tests/TestEmptyCaseWithStdoutOutput/EmptyTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

declare(strict_types=1);

namespace Tests\Unit;

use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;

class EmptyTest extends TestCase { }
4 changes: 4 additions & 0 deletions tests/TestEmptyCaseWithStdoutOutput/phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
beStrictAboutOutputDuringTests="true"
cacheResult="false" />
23 changes: 23 additions & 0 deletions tests/Unit/Adapters/PhpunitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,4 +256,27 @@ public function itHasOutputInStdoutWithBeStrictAboutOutputDuringTestsFalse(): vo
$process->getOutput()
);
}

#[Test]
public function itShowsWarningsOnEmptyTests(): void
{
$process = new Process([
'./vendor/bin/pest',
'-c',
'tests/LaravelApp/phpunit.xml',
'tests/TestEmptyCaseWithStdoutOutput',
'--disallow-test-output',
], __DIR__.'/../../..', [
'COLLISION_PRINTER' => 'DefaultPrinter',
'COLLISION_IGNORE_DURATION' => 'true',
]);

$process->run();

$basePath = getcwd();

$this->assertConsoleOutputContainsString("WARN No tests found", $process->getOutput()
);

}
}