forked from sebastianbergmann/phpunit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
150bb82
commit e50d3b4
Showing
2 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--TEST-- | ||
GH-2861: test names show numeric datasource only for iterators as dataprovider | ||
GH-2639: Second `yield from` is not called from a data provider | ||
--FILE-- | ||
<?php | ||
$_SERVER['argv'][1] = '--no-configuration'; | ||
$_SERVER['argv'][1] = '--debug'; | ||
$_SERVER['argv'][2] = 'Issue2861Test'; | ||
$_SERVER['argv'][3] = __DIR__ . '/2861/Issue2861Test.php'; | ||
|
||
require __DIR__ . '/../../bootstrap.php'; | ||
|
||
PHPUnit\TextUI\Command::main(); | ||
?> | ||
--EXPECTF-- | ||
PHPUnit %s by Sebastian Bergmann and contributors. | ||
|
||
Runtime:%s | ||
Configuration: %s | ||
|
||
Test 'Issue2861Test::testArrayProvider with data set "xyx" (11, 111)' started | ||
%s | ||
Test 'Issue2861Test::testIteratorProvider with data set "bla" (1, 11)' started | ||
%s | ||
Test 'Issue2861Test::testMultipleIteratorProviders with data set "bla" (1, 11)' started | ||
%s | ||
Test 'Issue2861Test::testMultipleIteratorProviders with data set #0 (22, 2)' started | ||
%s | ||
Test 'Issue2861Test::testMultipleIteratorProviders with data set "xyx" (11, 111)' started | ||
%s | ||
Test 'Issue2861Test::testMultipleIteratorProviders with data set #1 (23, 31)' started | ||
%s | ||
Test 'Issue2861Test::testMultipleIteratorProviders with data set #2 (24, 44)' started | ||
%s | ||
|
||
|
||
Time: %s, Memory: %s | ||
|
||
OK (7 tests, 7 assertions) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
use PHPUnit\Framework\TestCase; | ||
|
||
class Issue2861Test extends TestCase | ||
{ | ||
/** | ||
* @dataProvider arrayProvider | ||
*/ | ||
public function testArrayProvider() | ||
{ | ||
// shows key as datasource | ||
$this->assertTrue(true); | ||
} | ||
|
||
/** | ||
* @dataProvider iteratorProvider | ||
*/ | ||
public function testIteratorProvider() | ||
{ | ||
// shows numeric datasource | ||
$this->assertTrue(true); | ||
} | ||
|
||
/** | ||
* @dataProvider multipleIteratorProvider | ||
*/ | ||
public function testMultipleIteratorProviders() | ||
{ | ||
// shows mixed datasource | ||
$this->assertTrue(true); | ||
} | ||
|
||
public static function arrayProvider() | ||
{ | ||
return array( | ||
'xyx' => array(11,111), | ||
); | ||
} | ||
|
||
public static function iteratorProvider() | ||
{ | ||
yield 'bla' => array(1, 11); | ||
} | ||
|
||
public static function multipleIteratorProvider() | ||
{ | ||
yield from self::iteratorProvider(); | ||
yield array(22, 2); | ||
yield from self::arrayProvider(); | ||
yield from array(array(23, 31), array(24, 44)); | ||
} | ||
|
||
} |