GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — "Empty data set provided by data provider" · Issue #251 · phpstan/phpstan-phpunit

"Empty data set provided by data provider" #251

New issue
Copy link
New issue
Copy link
Open
#328
Open
"Empty data set provided by data provider"#251
#328
Copy link

Description

@staabm
staabm
opened on Oct 29, 2025
Issue body actions

Starting with PHPUnit 10 a dataprovider is not allowed to provide a empty array.

<?php

use PHPUnit\Framework\Attributes\DataProvider;

class BarTest extends PHPUnit\Framework\TestCase
{
    /**
     * @dataProvider provideData
     */
    #[DataProvider("provideData")]
    public function testBar() {
        self::assertTrue(true);
    }

    static public function provideData(): iterable {
        return [];
    }
}

real world example in phpstan-doctrine


PHPUnit 9 skips and warns

➜  phpunit git:(9.6) ✗ php phpunit BarTest.php
PHPUnit 9.6.29-15-g3ee3d102e by Sebastian Bergmann and contributors.

Runtime:       PHP 8.3.27
Configuration: /Users/staabm/workspace/phpunit/phpunit.xml

S                                                                   1 / 1 (100%)

Time: 00:00.002, Memory: 6.00 MB

There was 1 skipped test:

1) BarTest::testBar
Test for BarTest::testBar skipped by data provider
PHPUnit\Framework\SkippedTestError: <no message>
/Users/staabm/workspace/phpunit/src/Util/Annotation/DocBlock.php:285
/Users/staabm/workspace/phpunit/src/Util/Test.php:329
/Users/staabm/workspace/phpunit/src/Framework/TestBuilder.php:72
/Users/staabm/workspace/phpunit/src/Framework/TestSuite.php:891
/Users/staabm/workspace/phpunit/src/Framework/TestSuite.php:232
/Users/staabm/workspace/phpunit/src/Runner/BaseTestRunner.php:133
/Users/staabm/workspace/phpunit/src/TextUI/Command.php:121
/Users/staabm/workspace/phpunit/src/TextUI/Command.php:99

/Users/staabm/workspace/phpunit/src/Framework/Assert.php:2895
/Users/staabm/workspace/phpunit/src/Framework/SkippedTestCase.php:66
/Users/staabm/workspace/phpunit/src/Framework/TestCase.php:1223
/Users/staabm/workspace/phpunit/src/Framework/TestResult.php:729
/Users/staabm/workspace/phpunit/src/Framework/TestCase.php:973
/Users/staabm/workspace/phpunit/src/Framework/TestSuite.php:685
/Users/staabm/workspace/phpunit/src/Framework/TestSuite.php:685
/Users/staabm/workspace/phpunit/src/TextUI/TestRunner.php:651
/Users/staabm/workspace/phpunit/src/TextUI/Command.php:146
/Users/staabm/workspace/phpunit/src/TextUI/Command.php:99

OK, but incomplete, skipped, or risky tests!
Tests: 1, Assertions: 0, Skipped: 1.

PHPUnit 10 errors

➜  phpunit git:(10.5) ✗ php phpunit BarTest.php
PHPUnit 10.5.58-15-gc66b7d664 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.3.27
Configuration: /Users/staabm/workspace/phpunit/phpunit.xml

There was 1 PHPUnit error:

1) BarTest::testBar
The data provider specified for BarTest::testBar is invalid
Empty data set provided by data provider
/Users/staabm/workspace/phpunit/src/Metadata/Api/DataProvider.php:76
/Users/staabm/workspace/phpunit/src/Framework/TestBuilder.php:44
/Users/staabm/workspace/phpunit/src/Framework/TestSuite.php:511
/Users/staabm/workspace/phpunit/src/Framework/TestSuite.php:139
/Users/staabm/workspace/phpunit/src/TextUI/Configuration/TestSuiteBuilder.php:122
/Users/staabm/workspace/phpunit/src/TextUI/Configuration/TestSuiteBuilder.php:58
/Users/staabm/workspace/phpunit/src/TextUI/Application.php:394
/Users/staabm/workspace/phpunit/src/TextUI/Application.php:114

/Users/staabm/workspace/phpunit/BarTest.php:11

--

There was 1 PHPUnit test runner warning:

1) No tests found in class "BarTest".

No tests executed!

PHPUnit11,12,13 errors

➜  phpunit git:(11.5) ✗ php phpunit BarTest.php
PHPUnit 11.5.42-27-g32e5fd8bc by Sebastian Bergmann and contributors.

Runtime:       PHP 8.3.27
Configuration: /Users/staabm/workspace/phpunit/phpunit.xml

There was 1 PHPUnit error:

1) BarTest::testBar
The data provider specified for BarTest::testBar is invalid
Empty data set provided by data provider
/Users/staabm/workspace/phpunit/src/Metadata/Api/DataProvider.php:75
/Users/staabm/workspace/phpunit/src/Framework/TestBuilder.php:47
/Users/staabm/workspace/phpunit/src/Framework/TestSuite.php:508
/Users/staabm/workspace/phpunit/src/Framework/TestSuite.php:109
/Users/staabm/workspace/phpunit/src/TextUI/Configuration/TestSuiteBuilder.php:121
/Users/staabm/workspace/phpunit/src/TextUI/Configuration/TestSuiteBuilder.php:58
/Users/staabm/workspace/phpunit/src/TextUI/Application.php:412
/Users/staabm/workspace/phpunit/src/TextUI/Application.php:182

/Users/staabm/workspace/phpunit/BarTest.php:11

--

There was 1 PHPUnit test runner warning:

1) No tests found in class "BarTest".

No tests executed!

Activity

  1. staabm commented on Sep 12, 2026

    @staabm
    staabm
    on Sep 12, 2026
    ContributorAuthor
    More actions

    @SanderMuller this one might be interessting for you to implement

    Reacted by Sander Muller
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.