Skip to content

Commit 0165cfc

Browse files
Add test for #5621
1 parent 1ab3afa commit 0165cfc

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php declare(strict_types=1);
2+
/*
3+
* This file is part of PHPUnit.
4+
*
5+
* (c) Sebastian Bergmann <[email protected]>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
namespace PHPUnit\TestFixture\TeamCity;
11+
12+
use PHPUnit\Framework\Attributes\DataProvider;
13+
use PHPUnit\Framework\TestCase;
14+
15+
final class DataProviderTest extends TestCase
16+
{
17+
public static function provider(): array
18+
{
19+
return [
20+
[true],
21+
[false],
22+
];
23+
}
24+
25+
#[DataProvider('provider')]
26+
public function testOne(bool $value): void
27+
{
28+
$this->assertTrue($value);
29+
}
30+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
--TEST--
2+
phpunit --teamcity _files/DataProviderTest.php
3+
--FILE--
4+
<?php declare(strict_types=1);
5+
$_SERVER['argv'][] = '--do-not-cache-result';
6+
$_SERVER['argv'][] = '--no-configuration';
7+
$_SERVER['argv'][] = '--teamcity';
8+
$_SERVER['argv'][] = __DIR__ . '/_files/DataProviderTest.php';
9+
10+
require_once __DIR__ . '/../../bootstrap.php';
11+
12+
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
13+
--EXPECTF--
14+
PHPUnit %s by Sebastian Bergmann and contributors.
15+
16+
Runtime: %s
17+
18+
19+
##teamcity[testCount count='2' flowId='%d']
20+
21+
##teamcity[testSuiteStarted name='PHPUnit\TestFixture\TeamCity\DataProviderTest' locationHint='php_qn:///%sDataProviderTest.php::\PHPUnit\TestFixture\TeamCity\DataProviderTest' flowId='%d']
22+
23+
##teamcity[testSuiteStarted name='testOne' locationHint='php_qn:///%sDataProviderTest.php::\PHPUnit\TestFixture\TeamCity\DataProviderTest::testOne' flowId='%d']
24+
25+
##teamcity[testStarted name='testOne with data set #0' locationHint='php_qn:///%sDataProviderTest.php::\PHPUnit\TestFixture\TeamCity\DataProviderTest::testOne with data set #0' flowId='%d']
26+
27+
##teamcity[testFinished name='testOne with data set #0' duration='%d' flowId='%d']
28+
29+
##teamcity[testStarted name='testOne with data set #1' locationHint='php_qn:///%sDataProviderTest.php::\PHPUnit\TestFixture\TeamCity\DataProviderTest::testOne with data set #1' flowId='%d']
30+
31+
##teamcity[testFailed name='testOne with data set #1' message='Failed asserting that false is true.' details='/%sDataProviderTest.php:20|n' duration='%d' flowId='%d']
32+
33+
##teamcity[testFinished name='testOne with data set #1' duration='%d' flowId='%d']
34+
35+
##teamcity[testSuiteFinished name='testOne' flowId='%d']
36+
37+
##teamcity[testSuiteFinished name='PHPUnit\TestFixture\TeamCity\DataProviderTest' flowId='%d']
38+
Time: %s, Memory: %s
39+
40+
There was 1 failure:
41+
42+
1) PHPUnit\TestFixture\TeamCity\DataProviderTest::testOne with data set #1 (false)
43+
Failed asserting that false is true.
44+
45+
/%sDataProviderTest.php:20
46+
47+
FAILURES!
48+
Tests: 2, Assertions: 2, Failures: 1.

0 commit comments

Comments
 (0)