Skip to content

Commit

Permalink
Closes #5138
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Jan 17, 2023
1 parent f0a38e7 commit 5ffcf34
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Framework/TestSuite.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ public function count(): int

public function isEmpty(): bool
{
return $this->count() === 0;
return empty($this->tests);
}

/**
Expand Down
31 changes: 31 additions & 0 deletions tests/end-to-end/regression/5138.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
--TEST--
https://github.com/sebastianbergmann/phpunit/issues/5138
--FILE--
<?php declare(strict_types=1);
$_SERVER['argv'][] = '--do-not-cache-result';
$_SERVER['argv'][] = '--configuration';
$_SERVER['argv'][] = __DIR__ . '/5138/';

require_once __DIR__ . '/../../bootstrap.php';
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.

Runtime: %s
Configuration: %s

There was 1 PHPUnit error:

1) PHPUnit\TestFixture\Issue5138Test::testOne
The data provider specified for PHPUnit\TestFixture\Issue5138Test::testOne is invalid
message

%s:%d

--

There was 1 PHPUnit warning:

1) No tests found in class "PHPUnit\TestFixture\Issue5138Test".

No tests executed!
9 changes: 9 additions & 0 deletions tests/end-to-end/regression/5138/phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../phpunit.xsd">
<testsuites>
<testsuite name="default">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>
27 changes: 27 additions & 0 deletions tests/end-to-end/regression/5138/tests/Issue5138Test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\TestFixture;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use RuntimeException;

final class Issue5138Test extends TestCase
{
public static function provideData(): void
{
throw new RuntimeException('message');
}

#[DataProvider('provideData')]
public function testOne(): void
{
}
}

0 comments on commit 5ffcf34

Please sign in to comment.