prefix
stringlengths
512
512
suffix
stringlengths
256
256
middle
stringlengths
14
229
meta
dict
es=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\Runner\GarbageCollection; /** * @no-named-arguments Parameter names are...
e GarbageCollectionHandler $handler; public function __construct(GarbageCollectionHandler $handler) { $this->handler = $handler; } protected function handler(): GarbageCollectionHandler { return $this->handler; } }
r { privat
{ "filepath": "src/Runner/GarbageCollection/Subscriber/Subscriber.php", "language": "php", "file_size": 807, "cut_index": 536, "middle_length": 14 }
n <sebastian@phpunit.de> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace PHPUnit\Runner\GarbageCollection; use PHPUnit\Event\InvalidArgumentException; use PHPUnit\Event\Test\Finished; use PHPUnit\Event\Test\FinishedSubscrib...
ubscriber extends Subscriber implements FinishedSubscriber { /** * @throws \PHPUnit\Framework\InvalidArgumentException * @throws InvalidArgumentException */ public function notify(Finished $event): void { $this->handler()
e for PHPUnit */ final readonly class TestFinishedS
{ "filepath": "src/Runner/GarbageCollection/Subscriber/TestFinishedSubscriber.php", "language": "php", "file_size": 940, "cut_index": 606, "middle_length": 52 }
e(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. */ if (!defined('TEST_FILES_PATH')) { define('TEST_FILES_PATH', __DIR__ . DIRE...
composer) { if (!defined('PHPUNIT_COMPOSER_INSTALL')) { define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__) . '/vendor/autoload.php'); } require_once __DIR__ . '/../vendor/autoload.php'; } if ($phar) { if (!defined('__PHPUNIT_PHAR
{ print 'More than one test fixture autoloader is available, exiting.' . PHP_EOL; exit(1); } if (!$composer && !$phar) { print 'No test fixture autoloader was registered, exiting.' . PHP_EOL; exit(1); } if ($
{ "filepath": "tests/bootstrap.php", "language": "php", "file_size": 1450, "cut_index": 524, "middle_length": 229 }
e(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; ...
n new WrapperIteratorAggregate([ ['P'], ['Q'], ['R'], ]); } abstract public static function asArrayProvider(); abstract public static function asIteratorProvider(); abstract public static funct
]; } public static function asIteratorProviderInParent() { yield ['M']; yield ['N']; yield ['O']; } public static function asTraversableProviderInParent() { retur
{ "filepath": "tests/_files/AbstractVariousIterableDataProviderTest.php", "language": "php", "file_size": 1442, "cut_index": 524, "middle_length": 229 }
s=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; final class BankAccount { /** * The bank account's ...
ance) { $this->setBalance($this->getBalance() + $balance); return $this->getBalance(); } /** * Withdraws an amount of money from the bank account. * * @param float $balance * * @throws BankAccountExcep
{ return $this->balance; } /** * Deposits an amount of money to the bank account. * * @param float $balance * * @throws BankAccountException */ public function depositMoney($bal
{ "filepath": "tests/_files/BankAccount.php", "language": "php", "file_size": 1524, "cut_index": 537, "middle_length": 229 }
s=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\CoversFunction; use PHPUnit...
$balance = $ba->getBalance(); /* @Then I should get 0 */ $this->assertEquals(0, $balance); } #[Group('balanceCannotBecomeNegative')] #[Group('specification')] public function testBalanceCannotBecomeNegative(): void
Group('specification')] #[Group('1234')] public function testBalanceIsInitiallyZero(): void { /* @Given a fresh bank account */ $ba = new BankAccount; /* @When I ask it for its balance */
{ "filepath": "tests/_files/BankAccountTest.php", "language": "php", "file_size": 1645, "cut_index": 537, "middle_length": 229 }
* (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; final class ClassWithNonPublicAttributes extends ParentClassWithProtectedAttributes { public static $...
= 1; public $bar = 2; public $publicArray = ['foo']; protected $protectedAttribute = 'bar'; protected $privateAttribute = 'baz'; protected $protec
= 'foo'; public $foo
{ "filepath": "tests/_files/ClassWithNonPublicAttributes.php", "language": "php", "file_size": 987, "cut_index": 582, "middle_length": 52 }
* (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\Attributes\Depends; use PHPUnit\Fram...
} #[DataProvider('providerMethod')] #[Depends('testDependency')] public function testAdd($a, $b, $c): void { $this->assertSame(2, $c); $this->assertSame($c, $a + $b); } public function testDependency(): int {
], ['b' => 2, 'a' => 0], ];
{ "filepath": "tests/_files/DataProviderDependencyResultTest.php", "language": "php", "file_size": 967, "cut_index": 582, "middle_length": 52 }
* (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\Attributes\Depends; use PHPUnit\Fram...
pped.'); } public function testReference(): void { $this->markTestSkipped('This test should be skipped.'); } #[Depends('testReference')] #[DataProvider('provider')] #[Ticket('https://github.com/sebastianbergmann/phpuni
pped('Any test with this data provider should be ski
{ "filepath": "tests/_files/DataProviderDependencyTest.php", "language": "php", "file_size": 970, "cut_index": 582, "middle_length": 52 }
n <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\Attributes\Depends; use PHPUnit\Framework\TestCase; final c...
], ]; } #[DataProvider('provider')] #[Depends('testDependency')] public function testEquality($a, $b): void { $this->assertSame($a, $b); } public function testDependency(): void { $this->assertTrue(
=> 2, 'b' => 2], ['b' => 3, 'a' => 3
{ "filepath": "tests/_files/DataProviderDependencyVoidTest.php", "language": "php", "file_size": 929, "cut_index": 606, "middle_length": 52 }
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\DataProv...
er('dataProviderAdditions')] public function testAddNumbersWithDataProvider(int $a, int $b, int $sum): void { $this->assertSame($sum, $a + $b); } public function testTestInTheMiddleThatAlwaysWorks(): void { $this->asser
'1+2=3' => [1, 2, 3], '2+1=3' => [2, 1, 3], '1+1=3' => [1, 1, 3], ]; } public function testFirstTestThatAlwaysWorks(): void { $this->assertTrue(true); } #[DataProvid
{ "filepath": "tests/_files/DataProviderExecutionOrderTest.php", "language": "php", "file_size": 1211, "cut_index": 518, "middle_length": 229 }
hp 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\DataP...
alse], 'other false test' => [false], 'other false test2' => [false], ]; } #[DataProvider('truthProvider')] public function testTrue($truth): void { $this->assertTrue($truth); } #[DataProvi
[true], [true], [true], ]; } public static function falseProvider(): array { return [ 'false test' => [false], 'false test 2' => [f
{ "filepath": "tests/_files/DataProviderFilterTest.php", "language": "php", "file_size": 1116, "cut_index": 515, "middle_length": 229 }
* (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; final class DataProviderI...
self::markTestIncomplete('incomplete'); } #[DataProvider('incompleteTestProviderMethod')] public function testIncomplete($a, $b, $c): void { $this->assertTrue(true); } #[DataProvider('providerMethod')] public fun
ction incompleteTestProviderMethod(): array {
{ "filepath": "tests/_files/DataProviderIncompleteTest.php", "language": "php", "file_size": 978, "cut_index": 582, "middle_length": 52 }
s=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 Exception; use PHPUnit\Framework\Attributes\DataProvider...
} public function invalidProvider(): array { return [[true], [true]]; } #[RequiresPhpunit('< 10.0.0')] #[DataProvider('invalidProvider')] public function testWithInvalidDataProvider(bool $param): void { $this-
TestCase { public static function providerThatThrows(): array { throw new Exception('Should have been skipped.'); } public static function validProvider(): array { return [[true], [true]];
{ "filepath": "tests/_files/DataProviderRequiresPhpUnitTest.php", "language": "php", "file_size": 1564, "cut_index": 537, "middle_length": 229 }
* (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; final class DataProviderS...
arkTestSkipped('skipped'); } #[DataProvider('skippedTestProviderMethod')] public function testSkipped($a, $b, $c): void { $this->assertTrue(true); } #[DataProvider('providerMethod')] public function testAdd($a, $b, $c)
pedTestProviderMethod(): array { self::m
{ "filepath": "tests/_files/DataProviderSkippedTest.php", "language": "php", "file_size": 953, "cut_index": 582, "middle_length": 52 }
hp 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\DataP...
taProvider('provider', false)] public function testMethodHavingTwoParameters(bool $x1, bool $x2 = true): void { $this->assertSame($x1, $x2); } #[DataProvider('provider')] public function testMethodHavingVariadicParameter(bool $
ase, 2nd parameter is not required yield [true]; // correct case yield [true, true]; // incorrect case yield [true, true, 'Third argument, but test method only has two.']; } #[Da
{ "filepath": "tests/_files/DataProviderTooManyArgumentsNoValidationTest.php", "language": "php", "file_size": 1066, "cut_index": 515, "middle_length": 229 }
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\DataProv...
vider')] public function testMethodHavingTwoParameters(bool $x1, bool $x2 = true): void { $this->assertSame($x1, $x2); } #[DataProvider('provider')] public function testMethodHavingVariadicParameter(bool $x1, ...$rest): void
ter is not required yield [true]; // correct case yield [true, true]; // incorrect case yield [true, true, 'Third argument, but test method only has two.']; } #[DataProvider('pro
{ "filepath": "tests/_files/DataProviderTooManyArgumentsTest.php", "language": "php", "file_size": 1142, "cut_index": 518, "middle_length": 229 }
es=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\...
'0 + 1 = 1' => [0, 1, 1], '1 + 1 = 3' => [1, 1, 3], '1 + 0 = 1' => [1, 0, 1], ]; } #[DataProvider('providerMethod')] public function testAdd($a, $b, $c): void { $this->assertEquals($c, $a + $b);
],
{ "filepath": "tests/_files/DataProviderWithStringKeysTest.php", "language": "php", "file_size": 811, "cut_index": 536, "middle_length": 14 }
re(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;...
taProvider2(): iterable { return [ 'bar' => [2], ]; } #[DataProvider('dataProvider1')] #[DataProvider('dataProvider2')] public function test($value): void { $this->assertSame(2, $value); } }
[1], ]; } public static function da
{ "filepath": "tests/_files/DuplicateKeyDataProvidersTest.php", "language": "php", "file_size": 831, "cut_index": 523, "middle_length": 52 }
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 Exception; use InvalidArgumentExcepti...
throw new PHPUnit\Framework\Exception("Child exception\n{$message}", 101, $e); } } public function testNestedExceptions(): void { $exceptionThree = new Exception('Three'); $exceptionTwo = new InvalidArgumentExceptio
tion(): void { try { $this->assertEquals([1], [2], 'message'); } catch (ExpectationFailedException $e) { $message = $e->getMessage() . $e->getComparisonFailure()->getDiff();
{ "filepath": "tests/_files/ExceptionStackTest.php", "language": "php", "file_size": 1137, "cut_index": 518, "middle_length": 229 }
n <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; class FaillingDataProviderTest extends TestCase {...
]; } public function testOne(): void { $this->assertTrue(true); } #[DataProvider('provideData')] public function testWithProvider($sum, $summand, $summmand2): void { $this->assertSame($sum, $summand +
3' => [10, 5, 5], 'fail2' => [20, 3, 4],
{ "filepath": "tests/_files/FaillingDataProviderTest.php", "language": "php", "file_size": 935, "cut_index": 606, "middle_length": 52 }
art 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\TestCase; use stdClass; final class FailureTest extends TestCas...
$this->assertEquals($a, $b, 'message'); } public function testAssertNullEqualsString(): void { $this->assertEquals(null, 'bar', 'message'); } public function testAssertStringEqualsString(): void { $this->asse
$this->assertEquals(1, 2, 'message'); } public function testAssertObjectEqualsObject(): void { $a = new stdClass; $a->foo = 'bar'; $b = new stdClass; $b->bar = 'foo';
{ "filepath": "tests/_files/FailureTest.php", "language": "php", "file_size": 2224, "cut_index": 563, "middle_length": 229 }
s=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 function ini_get; use function ini_set; use PHPUnit\Fram...
d // below was not set by the test (or PHPUnit) inside the child process, // but can only have been forwarded as a command line option by PHPUnit // when it spawned the child process for this isolated test. $this->assertFals
testIniSettingNotChangeableAtRuntimeIsForwardedToChildProcess(): void { // max_input_time is PHP_INI_PERDIR and therefore cannot be changed // using ini_set() at runtime. This guarantees that the value asserte
{ "filepath": "tests/_files/IniSettingNotChangeableAtRuntimeTest.php", "language": "php", "file_size": 1523, "cut_index": 537, "middle_length": 229 }
?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\Dep...
: void { $this->assertEquals('foo', $a); $this->assertEquals('bar', $b); } #[DependsExternal(self::class, 'testThree')] public function testFour(): void { $this->assertTrue(true); } public function test
rue(true); return 'foo'; } public function testTwo() { $this->assertTrue(true); return 'bar'; } #[Depends('testOne')] #[Depends('testTwo')] public function testThree($a, $b)
{ "filepath": "tests/_files/MultiDependencyTest.php", "language": "php", "file_size": 1058, "cut_index": 513, "middle_length": 229 }
s=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 ArrayIterator; use ArrayObject; use Generator; use Itera...
l], [null, 'ok', null], [null, 'ok', null], ]; } public static function providerC(): array { return [ [null, null, 'ok'], [null, null, 'ok'], [null, null, 'ok'],
return [ ['ok', null, null], ['ok', null, null], ['ok', null, null], ]; } public static function providerB(): array { return [ [null, 'ok', nul
{ "filepath": "tests/_files/MultipleDataProviderTest.php", "language": "php", "file_size": 2001, "cut_index": 537, "middle_length": 229 }
n <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\TestCase; final class OutputTest extends TestCase { public function testExpectOutputStringFooActualFoo...
testExpectOutputRegexFooActualFoo(): void { $this->expectOutputRegex('/foo/'); print 'foo'; } public function testExpectOutputRegexFooActualBar(): void { $this->expectOutputRegex('/foo/'); print 'bar'; }
'); print 'bar'; } public function
{ "filepath": "tests/_files/OutputTest.php", "language": "php", "file_size": 917, "cut_index": 606, "middle_length": 52 }
pes=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 function count; use function end; use PHPUnit\Event; ...
ction lastRecordedEvent(): ?Event\Event { if ([] === $this->events) { return null; } return end($this->events); } final protected function record($event): void { $this->events[] = $event; }
rn count($this->events); } final public fun
{ "filepath": "tests/_files/RecordingSubscriber.php", "language": "php", "file_size": 845, "cut_index": 535, "middle_length": 52 }
tributes\RequiresOperatingSystem; use PHPUnit\Framework\Attributes\RequiresOperatingSystemFamily; use PHPUnit\Framework\Attributes\RequiresPhp; use PHPUnit\Framework\Attributes\RequiresPhpExtension; use PHPUnit\Framework\Attributes\RequiresPhpunit; use PHPUnit\Framework\Attributes\RequiresPhpunitExtension; use PHPUnit\...
void { } #[RequiresPhpunit('>= 2.0.0')] #[RequiresPhp('>= 1.0.0')] public function testFour(): void { } #[RequiresPhp('5.4.0RC6')] public function testFive(): void { } #[RequiresPhp('5.4.0-alpha1')] pu
irementsTest extends TestCase { public function testOne(): void { } #[RequiresPhpunit('>= 1.0.0')] public function testTwo(): void { } #[RequiresPhp('>= 2.0.0')] public function testThree():
{ "filepath": "tests/_files/RequirementsTest.php", "language": "php", "file_size": 9495, "cut_index": 921, "middle_length": 229 }
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\TestRunner\TestResult; use PHPUnit\Event\TestRunner\Issue\NoticeTriggered; use PHPUnit\Event\Te...
*/ final readonly class TestRunnerTriggeredIssueNoticeSubscriber extends Subscriber implements NoticeTriggeredSubscriber { public function notify(NoticeTriggered $event): void { $this->collector()->testRunnerTriggeredIssueNotice($event);
d by the backward compatibility promise for PHPUnit
{ "filepath": "src/Runner/TestResult/Subscriber/TestRunnerTriggeredIssueNoticeSubscriber.php", "language": "php", "file_size": 874, "cut_index": 559, "middle_length": 52 }
* 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\TestRunner\TestResult; use PHPUnit\Event\TestRunner\PhpDeprecationTriggered; use PH...
ise for PHPUnit */ final readonly class TestRunnerTriggeredIssuePhpDeprecationSubscriber extends Subscriber implements PhpDeprecationTriggeredSubscriber { public function notify(PhpDeprecationTriggered $event): void { $this->collector()->t
ss is not covered by the backward compatibility prom
{ "filepath": "src/Runner/TestResult/Subscriber/TestRunnerTriggeredIssuePhpDeprecationSubscriber.php", "language": "php", "file_size": 910, "cut_index": 547, "middle_length": 52 }
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\TestRunner\TestResult; use PHPUnit\Event\TestRunner\Issue\WarningTriggered; use PHPUnit\Event\T...
t */ final readonly class TestRunnerTriggeredIssueWarningSubscriber extends Subscriber implements WarningTriggeredSubscriber { public function notify(WarningTriggered $event): void { $this->collector()->testRunnerTriggeredIssueWarning($eve
red by the backward compatibility promise for PHPUni
{ "filepath": "src/Runner/TestResult/Subscriber/TestRunnerTriggeredIssueWarningSubscriber.php", "language": "php", "file_size": 880, "cut_index": 559, "middle_length": 52 }
ict_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\TestRunner\TestResult; use PHPUnit\Event\TestRunner\NoticeTrigger...
omise for PHPUnit */ final readonly class TestRunnerTriggeredPhpunitNoticeSubscriber extends Subscriber implements NoticeTriggeredSubscriber { public function notify(NoticeTriggered $event): void { $this->collector()->testRunnerTriggeredPh
lass is not covered by the backward compatibility pr
{ "filepath": "src/Runner/TestResult/Subscriber/TestRunnerTriggeredPhpunitNoticeSubscriber.php", "language": "php", "file_size": 866, "cut_index": 529, "middle_length": 52 }
es=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\TestRunner\TestResult; use PHPUnit\Event\TestSuite\Finished; use PHPUnit...
ompatibility promise for PHPUnit */ final readonly class TestSuiteFinishedSubscriber extends Subscriber implements FinishedSubscriber { public function notify(Finished $event): void { $this->collector()->testSuiteFinished($event); } }
the backward c
{ "filepath": "src/Runner/TestResult/Subscriber/TestSuiteFinishedSubscriber.php", "language": "php", "file_size": 806, "cut_index": 536, "middle_length": 14 }
ict_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\TestRunner\TestResult; use PHPUnit\Event\Test\DeprecationTriggere...
ise for PHPUnit */ final readonly class TestTriggeredDeprecationSubscriber extends Subscriber implements DeprecationTriggeredSubscriber { public function notify(DeprecationTriggered $event): void { $this->collector()->testTriggeredDeprecat
ss is not covered by the backward compatibility prom
{ "filepath": "src/Runner/TestResult/Subscriber/TestTriggeredDeprecationSubscriber.php", "language": "php", "file_size": 858, "cut_index": 529, "middle_length": 52 }
p 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\TestRunner\TestResult; use PHPUnit\Event\Test\Notice...
romise for PHPUnit */ final readonly class TestTriggeredNoticeSubscriber extends Subscriber implements NoticeTriggeredSubscriber { public function notify(NoticeTriggered $event): void { $this->collector()->testTriggeredNotice($event);
class is not covered by the backward compatibility p
{ "filepath": "src/Runner/TestResult/Subscriber/TestTriggeredNoticeSubscriber.php", "language": "php", "file_size": 828, "cut_index": 516, "middle_length": 52 }
pes=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\TestRunner\TestResult; use PHPUnit\Event\Test\PhpNoticeTriggered; use P...
PUnit */ final readonly class TestTriggeredPhpNoticeSubscriber extends Subscriber implements PhpNoticeTriggeredSubscriber { public function notify(PhpNoticeTriggered $event): void { $this->collector()->testTriggeredPhpNotice($event); }
covered by the backward compatibility promise for PH
{ "filepath": "src/Runner/TestResult/Subscriber/TestTriggeredPhpNoticeSubscriber.php", "language": "php", "file_size": 846, "cut_index": 535, "middle_length": 52 }
ict_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\TestRunner\TestResult; use PHPUnit\Event\Test\PhpWarningTriggered...
e for PHPUnit */ final readonly class TestTriggeredPhpWarningSubscriber extends Subscriber implements PhpWarningTriggeredSubscriber { public function notify(PhpWarningTriggered $event): void { $this->collector()->testTriggeredPhpWarning($e
is not covered by the backward compatibility promis
{ "filepath": "src/Runner/TestResult/Subscriber/TestTriggeredPhpWarningSubscriber.php", "language": "php", "file_size": 852, "cut_index": 529, "middle_length": 52 }
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\TestRunner\TestResult; use PHPUnit\Event\Test\PhpunitNoticeTriggered; use PHPUnit\Event\Test\Ph...
readonly class TestTriggeredPhpunitNoticeSubscriber extends Subscriber implements PhpunitNoticeTriggeredSubscriber { public function notify(PhpunitNoticeTriggered $event): void { $this->collector()->testTriggeredPhpunitNotice($event); }
ackward compatibility promise for PHPUnit */ final
{ "filepath": "src/Runner/TestResult/Subscriber/TestTriggeredPhpunitNoticeSubscriber.php", "language": "php", "file_size": 870, "cut_index": 559, "middle_length": 52 }
re(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\TestRunner\TestResult; use PHPUnit\Event\Test\WarningTrigge...
e for PHPUnit */ final readonly class TestTriggeredWarningSubscriber extends Subscriber implements WarningTriggeredSubscriber { public function notify(WarningTriggered $event): void { $this->collector()->testTriggeredWarning($event); }
is not covered by the backward compatibility promis
{ "filepath": "src/Runner/TestResult/Subscriber/TestTriggeredWarningSubscriber.php", "language": "php", "file_size": 834, "cut_index": 523, "middle_length": 52 }
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\TestRunner\TestResult; use PHPUnit\Event\TestRunner\PhpNoticeTriggered; use PHPUnit\Event\TestR...
nal readonly class TestRunnerTriggeredIssuePhpNoticeSubscriber extends Subscriber implements PhpNoticeTriggeredSubscriber { public function notify(PhpNoticeTriggered $event): void { $this->collector()->testRunnerTriggeredIssuePhpNotice($eve
he backward compatibility promise for PHPUnit */ fi
{ "filepath": "src/Runner/TestResult/Subscriber/TestRunnerTriggeredIssuePhpNoticeSubscriber.php", "language": "php", "file_size": 880, "cut_index": 559, "middle_length": 52 }
* 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\TestRunner\TestResult; use PHPUnit\Event\TestRunner\DeprecationTriggered; use PHPUn...
r PHPUnit */ final readonly class TestRunnerTriggeredPhpunitDeprecationSubscriber extends Subscriber implements DeprecationTriggeredSubscriber { public function notify(DeprecationTriggered $event): void { $this->collector()->testRunnerTrig
not covered by the backward compatibility promise fo
{ "filepath": "src/Runner/TestResult/Subscriber/TestRunnerTriggeredPhpunitDeprecationSubscriber.php", "language": "php", "file_size": 896, "cut_index": 547, "middle_length": 52 }
p 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\TestRunner\TestResult; use PHPUnit\Event\Test\Consid...
romise for PHPUnit */ final readonly class TestConsideredRiskySubscriber extends Subscriber implements ConsideredRiskySubscriber { public function notify(ConsideredRisky $event): void { $this->collector()->testConsideredRisky($event);
class is not covered by the backward compatibility p
{ "filepath": "src/Runner/TestResult/Subscriber/TestConsideredRiskySubscriber.php", "language": "php", "file_size": 828, "cut_index": 516, "middle_length": 52 }
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\TestRunner\TestResult; use PHPUnit\Event\TestRunner\WarningTriggered; use PHPUnit\Event\TestRun...
readonly class TestRunnerTriggeredPhpunitWarningSubscriber extends Subscriber implements WarningTriggeredSubscriber { public function notify(WarningTriggered $event): void { $this->collector()->testRunnerTriggeredPhpunitWarning($event);
ackward compatibility promise for PHPUnit */ final
{ "filepath": "src/Runner/TestResult/Subscriber/TestRunnerTriggeredPhpunitWarningSubscriber.php", "language": "php", "file_size": 872, "cut_index": 559, "middle_length": 52 }
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\TestRunner\TestResult; use PHPUnit\Event\TestSuite\St...
by the backward compatibility promise for PHPUnit */ final readonly class TestSuiteStartedSubscriber extends Subscriber implements StartedSubscriber { public function notify(Started $event): void { $this->collector()->testSuiteStarted($eve
s not covered
{ "filepath": "src/Runner/TestResult/Subscriber/TestSuiteStartedSubscriber.php", "language": "php", "file_size": 800, "cut_index": 517, "middle_length": 14 }
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\TestRunner\TestResult; use PHPUnit\Event\Test\PhpDeprecationTriggered; use PHPUnit\Event\Test\P...
l readonly class TestTriggeredPhpDeprecationSubscriber extends Subscriber implements PhpDeprecationTriggeredSubscriber { public function notify(PhpDeprecationTriggered $event): void { $this->collector()->testTriggeredPhpDeprecation($event);
backward compatibility promise for PHPUnit */ fina
{ "filepath": "src/Runner/TestResult/Subscriber/TestTriggeredPhpDeprecationSubscriber.php", "language": "php", "file_size": 876, "cut_index": 559, "middle_length": 52 }
ict_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\TestRunner\TestResult; use PHPUnit\Event\Test\PhpunitErrorTrigger...
omise for PHPUnit */ final readonly class TestTriggeredPhpunitErrorSubscriber extends Subscriber implements PhpunitErrorTriggeredSubscriber { public function notify(PhpunitErrorTriggered $event): void { $this->collector()->testTriggeredPhp
lass is not covered by the backward compatibility pr
{ "filepath": "src/Runner/TestResult/Subscriber/TestTriggeredPhpunitErrorSubscriber.php", "language": "php", "file_size": 864, "cut_index": 529, "middle_length": 52 }
s=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\Runner\GarbageCollection; use function gc_collect_cycles; use function gc...
nction __construct(Facade $facade, int $threshold) { $this->facade = $facade; $this->threshold = $threshold; $this->registerSubscribers(); } public function executionStarted(): void { gc_disable();
lass is not covered by the backward compatibility promise for PHPUnit */ final class GarbageCollectionHandler { private readonly Facade $facade; private readonly int $threshold; private int $tests = 0; public fu
{ "filepath": "src/Runner/GarbageCollection/GarbageCollectionHandler.php", "language": "php", "file_size": 2010, "cut_index": 537, "middle_length": 229 }
* 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\TestRunner\TestResult; use PHPUnit\Event\TestRunner\PhpWarningTriggered; use PHPUni...
PHPUnit */ final readonly class TestRunnerTriggeredIssuePhpWarningSubscriber extends Subscriber implements PhpWarningTriggeredSubscriber { public function notify(PhpWarningTriggered $event): void { $this->collector()->testRunnerTriggeredIs
t covered by the backward compatibility promise for
{ "filepath": "src/Runner/TestResult/Subscriber/TestRunnerTriggeredIssuePhpWarningSubscriber.php", "language": "php", "file_size": 886, "cut_index": 547, "middle_length": 52 }
re(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\TestRunner\TestResult; use PHPUnit\Event\Test\MarkedIncompl...
e for PHPUnit */ final readonly class TestMarkedIncompleteSubscriber extends Subscriber implements MarkedIncompleteSubscriber { public function notify(MarkedIncomplete $event): void { $this->collector()->testMarkedIncomplete($event); }
is not covered by the backward compatibility promis
{ "filepath": "src/Runner/TestResult/Subscriber/TestMarkedIncompleteSubscriber.php", "language": "php", "file_size": 834, "cut_index": 523, "middle_length": 52 }
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\TestRunner\TestResult; use PHPUnit\Event\Test\Erro...
romise for PHPUnit */ final readonly class TestTriggeredErrorSubscriber extends Subscriber implements ErrorTriggeredSubscriber { public function notify(ErrorTriggered $event): void { $this->collector()->testTriggeredError($event); } }
class is not covered by the backward compatibility p
{ "filepath": "src/Runner/TestResult/Subscriber/TestTriggeredErrorSubscriber.php", "language": "php", "file_size": 822, "cut_index": 514, "middle_length": 52 }
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\TestRunner\TestResult; use PHPUnit\Event\Test\PhpunitWarningTriggered; use PHPUnit\Event\Test\P...
l readonly class TestTriggeredPhpunitWarningSubscriber extends Subscriber implements PhpunitWarningTriggeredSubscriber { public function notify(PhpunitWarningTriggered $event): void { $this->collector()->testTriggeredPhpunitWarning($event);
backward compatibility promise for PHPUnit */ fina
{ "filepath": "src/Runner/TestResult/Subscriber/TestTriggeredPhpunitWarningSubscriber.php", "language": "php", "file_size": 876, "cut_index": 559, "middle_length": 52 }
?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\TestRunner\TestResult; use PHPUnit\Event\Test\Fin...
he backward compatibility promise for PHPUnit */ final readonly class TestFinishedSubscriber extends Subscriber implements FinishedSubscriber { public function notify(Finished $event): void { $this->collector()->testFinished($event); }
t covered by t
{ "filepath": "src/Runner/TestResult/Subscriber/TestFinishedSubscriber.php", "language": "php", "file_size": 786, "cut_index": 513, "middle_length": 14 }
* 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\TestRunner\TestResult; use PHPUnit\Event\Test\PhpunitDeprecationTriggered; use PHPU...
for PHPUnit */ final readonly class TestTriggeredPhpunitDeprecationSubscriber extends Subscriber implements PhpunitDeprecationTriggeredSubscriber { public function notify(PhpunitDeprecationTriggered $event): void { $this->collector()->test
s not covered by the backward compatibility promise
{ "filepath": "src/Runner/TestResult/Subscriber/TestTriggeredPhpunitDeprecationSubscriber.php", "language": "php", "file_size": 900, "cut_index": 547, "middle_length": 52 }
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\TestRunner\TestResult; use PHPUnit\Event\TestSuite\Sk...
by the backward compatibility promise for PHPUnit */ final readonly class TestSuiteSkippedSubscriber extends Subscriber implements SkippedSubscriber { public function notify(Skipped $event): void { $this->collector()->testSuiteSkipped($eve
s not covered
{ "filepath": "src/Runner/TestResult/Subscriber/TestSuiteSkippedSubscriber.php", "language": "php", "file_size": 800, "cut_index": 517, "middle_length": 14 }
hp 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\Metadata\Attribute; use PHPUnit\Framewo...
re\Metadata\Attribute')] #[CoversClass(Example::class)] #[CoversClassesThatExtendClass(Example::class)] #[CoversClassesThatImplementInterface(Example::class)] #[CoversTrait(ExampleTrait::class)] #[CoversMethod(Example::class, 'method')] #[CoversFunction('f
\CoversFunction; use PHPUnit\Framework\Attributes\CoversMethod; use PHPUnit\Framework\Attributes\CoversNamespace; use PHPUnit\Framework\Attributes\CoversTrait; use PHPUnit\Framework\TestCase; #[CoversNamespace('PHPUnit\TestFixtu
{ "filepath": "tests/_files/Metadata/Attribute/tests/CoversTest.php", "language": "php", "file_size": 1096, "cut_index": 515, "middle_length": 229 }
s=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\Metadata\Attribute; use PHPUnit\Framework\Attributes\Depends;...
HPUnit\Framework\Attributes\DependsUsingShallowClone; use PHPUnit\Framework\TestCase; final class DependencyTest extends TestCase { #[Depends('testOne')] public function testOne(): void { } #[DependsUsingDeepClone('testOne')] publ
t\Framework\Attributes\DependsOnClass; use PHPUnit\Framework\Attributes\DependsOnClassUsingDeepClone; use PHPUnit\Framework\Attributes\DependsOnClassUsingShallowClone; use PHPUnit\Framework\Attributes\DependsUsingDeepClone; use P
{ "filepath": "tests/_files/Metadata/Attribute/tests/DependencyTest.php", "language": "php", "file_size": 1809, "cut_index": 537, "middle_length": 229 }
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\Basic; use Exception; use PHPUnit\Framewor...
*/ class SetUpBeforeClassTest extends TestCase { public static function setUpBeforeClass(): void { throw new Exception('forcing an Exception in setUpBeforeClass()'); } protected function setUp(): void { throw new Exce
ed? * - tests are not executed * * @see https://github.com/sebastianbergmann/phpunit/issues/2145 * @see https://github.com/sebastianbergmann/phpunit/issues/3107 * @see https://github.com/sebastianbergmann/phpunit/issues/3364
{ "filepath": "tests/end-to-end/_files/basic/unit/SetUpBeforeClassTest.php", "language": "php", "file_size": 1220, "cut_index": 518, "middle_length": 229 }
<?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\Basic; use PHPUnit\Framework\TestCas...
RuntimeException('throw exception in setUp'); } public function testOneWithSetUpException(): void { $this->assertTrue(false); } public function testTwoWithSetUpException(): void { $this->assertTrue(false); } }
* @see https://github.com/sebastianbergmann/phpunit/issues/3107 * @see https://github.com/sebastianbergmann/phpunit/issues/3364 */ class SetUpTest extends TestCase { protected function setUp(): void { throw new
{ "filepath": "tests/end-to-end/_files/basic/unit/SetUpTest.php", "language": "php", "file_size": 997, "cut_index": 512, "middle_length": 229 }
art 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\Basic; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\R...
:class); $this->assertTrue(true); } public function testFailure(): void { $this->assertTrue(false); } public function testError(): void { throw new RuntimeException; } public function testIncomple
eption; #[CoversClass('Foo')] #[UsesClass('Bar')] #[TestDox('Test result status with and without message')] class StatusTest extends TestCase { public function testSuccess(): void { $this->createMock(AnInterface:
{ "filepath": "tests/end-to-end/_files/basic/unit/StatusTest.php", "language": "php", "file_size": 2113, "cut_index": 563, "middle_length": 229 }
* 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\Basic; use Exception; use PHPUnit\Framework\TestCase; /** * Class Tea...
static function tearDownAfterClass(): void { throw new Exception('forcing an Exception in tearDownAfterClass()'); } public function testOne(): void { $this->assertTrue(true); } public function testTwo(): void
TearDownAfterClassTest extends TestCase { public
{ "filepath": "tests/end-to-end/_files/basic/unit/TearDownAfterClassTest.php", "language": "php", "file_size": 898, "cut_index": 547, "middle_length": 52 }
es=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\requires_environment_variable; use PHPUnit\Framework\Attribu...
is->fail(); } #[RequiresEnvironmentVariable('BAZ')] public function testShouldNotRunBAZDoesNotExist(): void { $this->fail(); } #[RequiresEnvironmentVariable('FOO')] public function testOneShouldRun(): void {
le('FOO', 'bar')] public function testShouldNotRunFOOHasWrongValue(): void { $this->fail(); } #[RequiresEnvironmentVariable('BAR')] public function testShouldNotRunBARIsEmpty(): void { $th
{ "filepath": "tests/end-to-end/_files/requires_environment_variable/SomeTest.php", "language": "php", "file_size": 1512, "cut_index": 537, "middle_length": 229 }
es=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\requires_environment_variable; use function getenv; use PHPU...
ultValues(); } protected function setUp(): void { $this->assertEnvironmentVariablesHaveCustomValues(); } protected function tearDown(): void { $this->assertEnvironmentVariablesHaveCustomValues(); } #[WithE
ublic static function setUpBeforeClass(): void { self::assertEnvironmentVariablesHaveDefaultValues(); } public static function tearDownAfterClass(): void { self::assertEnvironmentVariablesHaveDefa
{ "filepath": "tests/end-to-end/_files/with_environment_variable/WithEnvironmentVariableHookTest.php", "language": "php", "file_size": 1763, "cut_index": 537, "middle_length": 229 }
stian@phpunit.de> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace PHPUnit\TestFixture\requires_environment_variable; use function getenv; use PHPUnit\Framework\Attributes\Depends; use PHPUnit\Framework\Attributes\RequiresEn...
getenv('FOO')); } #[WithEnvironmentVariable('FOO', 'bar')] public function testFOOShouldHaveValueOverriddenFromMethodAttribute(): void { $this->assertSame('bar', $_ENV['FOO']); $this->assertSame('bar', getenv('FOO'));
FOO', 'foo')] final class WithEnvironmentVariableTest extends TestCase { public function testFOOShouldHaveValueFromClassAttribute1(): void { $this->assertSame('foo', $_ENV['FOO']); $this->assertSame('foo',
{ "filepath": "tests/end-to-end/_files/with_environment_variable/WithEnvironmentVariableTest.php", "language": "php", "file_size": 4003, "cut_index": 614, "middle_length": 229 }
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\LogEventsText; use function fopen; use PHP...
o, world!', 'hello, world!'); } public function testExportArray(): void { $arr = [1, 'foo' => 2]; $this->assertSame($arr, $arr); } public function testExportObject(): void { $this->assertSame(new stdClass,
ortBool(): void { $this->assertTrue(true); } public function testExportInt(): void { $this->assertSame(1, 1); } public function testExportStr(): void { $this->assertSame('hell
{ "filepath": "tests/end-to-end/_files/log-events-text/Test.php", "language": "php", "file_size": 1173, "cut_index": 518, "middle_length": 229 }
s=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\DoNotFailOn; use const E_USER_DEPRECATED; use const E_USER_NO...
} public function testThatTriggersPhpunitWarning(): void { EventFacade::emitter()->testTriggeredPhpunitWarning( $this->valueObjectForEvents(), 'message', ); $this->assertTrue(true); } pu
on testThatTriggersPhpunitDeprecation(): void { EventFacade::emitter()->testTriggeredPhpunitDeprecation( $this->valueObjectForEvents(), 'message', ); $this->assertTrue(true);
{ "filepath": "tests/end-to-end/_files/do-not-fail-on/tests/IssueTest.php", "language": "php", "file_size": 1736, "cut_index": 537, "middle_length": 229 }
s=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\AttributesOnTemplateMethods; use PHPUnit\Framework\Attributes...
ction before_class(): void { } #[AfterClass] #[Test] public static function after_class(): void { } #[Test] public static function setUpBeforeClass(): void { } #[Test] public static function tearDownAf
PHPUnit\Framework\Attributes\PreCondition; use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; final class TestAttributeOnHookMethodsTest extends TestCase { #[BeforeClass] #[Test] public static fun
{ "filepath": "tests/end-to-end/_files/test-attribute-on-hook-methods/TestAttributeOnHookMethodsTest.php", "language": "php", "file_size": 1739, "cut_index": 537, "middle_length": 229 }
n <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\TestRunnerStopping; use const E_USER_DEPRECATED; use function trigger_error; use PHPUnit\Event\Facade as EventFacade; use PHPUnit\...
{ $this->assertTrue(true); } public function testThree(): void { $this->assertTrue(true); EventFacade::emitter()->testTriggeredPhpunitDeprecation( $this->valueObjectForEvents(), 'message',
ue); } public function testTwo(): void
{ "filepath": "tests/end-to-end/_files/stop-on-fail-on/DeprecationTest.php", "language": "php", "file_size": 928, "cut_index": 606, "middle_length": 52 }
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\TestRunnerStopping; use const SIGINT; ...
#[RunInSeparateProcess] public function testOne(): void { $this->assertTrue(true); posix_kill(posix_getppid(), SIGINT); } #[RunInSeparateProcess] public function testTwo(): void { $this->assertTrue(true);
estCase {
{ "filepath": "tests/end-to-end/_files/stop-on-fail-on/InterruptProcessIsolationTest.php", "language": "php", "file_size": 791, "cut_index": 514, "middle_length": 14 }
pes=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\TestRunnerStopping; use const E_USER_WARNING; use function ...
throw new Exception('message'); } public function testThree(): void { trigger_error('message', E_USER_WARNING); $this->assertTrue(true); } public function testFour(): void { $this->assertTrue(true);
} public function testTwo(): void {
{ "filepath": "tests/end-to-end/_files/stop-on-fail-on/MultipleDefectTest.php", "language": "php", "file_size": 847, "cut_index": 535, "middle_length": 52 }
n <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\TestRunnerStopping; use const E_USER_NOTICE; use function trigger_error; use PHPUnit\Framework\TestCase; final class MultipleNoti...
CE); $this->assertTrue(true); } public function testThree(): void { trigger_error('message', E_USER_NOTICE); $this->assertTrue(true); } public function testFour(): void { $this->assertTrue(true);
d { trigger_error('message', E_USER_NOTI
{ "filepath": "tests/end-to-end/_files/stop-on-fail-on/MultipleNoticeTest.php", "language": "php", "file_size": 922, "cut_index": 606, "middle_length": 52 }
n <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\TestRunnerStopping; use const E_USER_WARNING; use function trigger_error; use PHPUnit\Framework\TestCase; final class MultipleWar...
ARNING); $this->assertTrue(true); } public function testThree(): void { trigger_error('message', E_USER_WARNING); $this->assertTrue(true); } public function testFour(): void { $this->assertTrue(tr
void { trigger_error('message', E_USER_W
{ "filepath": "tests/end-to-end/_files/stop-on-fail-on/MultipleWarningTest.php", "language": "php", "file_size": 927, "cut_index": 606, "middle_length": 52 }
ict_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\TestRunnerStopping; use const E_USER_DEPRECATED; use ...
} public function testTwo(): void { trigger_error('...bar...', E_USER_DEPRECATED); $this->assertTrue(true); } public function testThree(): void { trigger_error('...baz...', E_USER_DEPRECATED); $thi
SER_DEPRECATED); $this->assertTrue(true);
{ "filepath": "tests/end-to-end/_files/stop-on-fail-on/SpecificDeprecationTest.php", "language": "php", "file_size": 866, "cut_index": 529, "middle_length": 52 }
n <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\TestRunnerStopping; use const E_USER_DEPRECATED; use function trigger_error; use PHPUnit\Framework\TestCase; final class Suppress...
sertTrue(true); } public function testThree(): void { trigger_error('non-suppressed message', E_USER_DEPRECATED); $this->assertTrue(true); } public function testFour(): void { $this->assertTrue(true);
lic function testTwo(): void { $this->as
{ "filepath": "tests/end-to-end/_files/stop-on-fail-on/SuppressedDeprecationTest.php", "language": "php", "file_size": 918, "cut_index": 606, "middle_length": 52 }
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\DataProvider; use PHPUnit\Framework\Attri...
} public static function providerB(): array { return ['shared' => [2]]; } #[DataProvider('providerA')] #[DataProvider('providerB')] public function testOne(int $value): void { $this->assertGreaterThan(0, $value
=> [1]];
{ "filepath": "tests/end-to-end/_files/data-provider/DuplicateKeyAcrossProvidersTest.php", "language": "php", "file_size": 798, "cut_index": 517, "middle_length": 14 }
s=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\Baseline; use const E_USER_DEPRECATED; use const E_USER_NOTIC...
hpDeprecation(); } public function triggerPhpNoticeAndWarning(): void { $this->phpNoticeAndWarning(); } private function deprecation(): void { @trigger_error('deprecation', E_USER_DEPRECATED); } private fu
ublic function triggerNotice(): void { $this->notice(); } public function triggerWarning(): void { $this->warning(); } public function triggerPhpDeprecation(): void { $this->p
{ "filepath": "tests/end-to-end/_files/baseline/generate-baseline-suppressed/src/Source.php", "language": "php", "file_size": 1656, "cut_index": 537, "middle_length": 229 }
?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\Baseline; use PHPUnit\Framework\TestC...
} public function testPhpDeprecation(): void { (new Source)->triggerPhpDeprecation(); $this->assertTrue(true); } public function testPhpNoticeAndWarning(): void { (new Source)->triggerPhpNoticeAndWarning(
tion testNotice(): void { (new Source)->triggerNotice(); $this->assertTrue(true); } public function testWarning(): void { (new Source)->triggerWarning(); $this->assertTrue(true);
{ "filepath": "tests/end-to-end/_files/baseline/generate-baseline-suppressed/tests/Test.php", "language": "php", "file_size": 1043, "cut_index": 513, "middle_length": 229 }
s=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\Baseline; use const E_USER_DEPRECATED; use const E_USER_NOTIC...
hpDeprecation(); } public function triggerPhpNoticeAndWarning(): void { $this->phpNoticeAndWarning(); } private function deprecation(): void { trigger_error('deprecation', E_USER_DEPRECATED); } private fun
ublic function triggerNotice(): void { $this->notice(); } public function triggerWarning(): void { $this->warning(); } public function triggerPhpDeprecation(): void { $this->p
{ "filepath": "tests/end-to-end/_files/baseline/use-baseline/src/Source.php", "language": "php", "file_size": 1651, "cut_index": 537, "middle_length": 229 }
?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\Baseline; use PHPUnit\Framework\TestC...
true); } public function testPhpDeprecation(): void { (new Source)->triggerPhpDeprecation(); $this->assertTrue(true); } public function testPhpNoticeAndWarning(): void { (new Source)->triggerPhpNoticeAndWa
c function testNotice(): void { (new Source)->triggerNotice(); $this->assertTrue(true); } public function testWarning(): void { (new Source)->triggerWarning(); $this->assertTrue(
{ "filepath": "tests/end-to-end/_files/baseline/use-baseline/tests/SourceTest.php", "language": "php", "file_size": 1049, "cut_index": 513, "middle_length": 229 }
s=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\Baseline; use const E_USER_DEPRECATED; use const E_USER_NOTIC...
hpDeprecation(); } public function triggerPhpNoticeAndWarning(): void { $this->phpNoticeAndWarning(); } private function deprecation(): void { trigger_error('deprecation', E_USER_DEPRECATED); } private fun
ublic function triggerNotice(): void { $this->notice(); } public function triggerWarning(): void { $this->warning(); } public function triggerPhpDeprecation(): void { $this->p
{ "filepath": "tests/end-to-end/_files/baseline/generate-baseline/src/Source.php", "language": "php", "file_size": 1651, "cut_index": 537, "middle_length": 229 }
?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\Baseline; use PHPUnit\Framework\TestC...
} public function testPhpDeprecation(): void { (new Source)->triggerPhpDeprecation(); $this->assertTrue(true); } public function testPhpNoticeAndWarning(): void { (new Source)->triggerPhpNoticeAndWarning(
tion testNotice(): void { (new Source)->triggerNotice(); $this->assertTrue(true); } public function testWarning(): void { (new Source)->triggerWarning(); $this->assertTrue(true);
{ "filepath": "tests/end-to-end/_files/baseline/generate-baseline/tests/Test.php", "language": "php", "file_size": 1043, "cut_index": 513, "middle_length": 229 }
s=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\Baseline; use const E_USER_DEPRECATED; use const E_USER_NOTIC...
hpDeprecation(); } public function triggerPhpNoticeAndWarning(): void { $this->phpNoticeAndWarning(); } private function deprecation(): void { @trigger_error('deprecation', E_USER_DEPRECATED); } private fu
ublic function triggerNotice(): void { $this->notice(); } public function triggerWarning(): void { $this->warning(); } public function triggerPhpDeprecation(): void { $this->p
{ "filepath": "tests/end-to-end/_files/baseline/generate-baseline-suppressed-with-ignored-suppression/src/Source.php", "language": "php", "file_size": 1656, "cut_index": 537, "middle_length": 229 }
?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\Baseline; use PHPUnit\Framework\TestC...
} public function testPhpDeprecation(): void { (new Source)->triggerPhpDeprecation(); $this->assertTrue(true); } public function testPhpNoticeAndWarning(): void { (new Source)->triggerPhpNoticeAndWarning(
tion testNotice(): void { (new Source)->triggerNotice(); $this->assertTrue(true); } public function testWarning(): void { (new Source)->triggerWarning(); $this->assertTrue(true);
{ "filepath": "tests/end-to-end/_files/baseline/generate-baseline-suppressed-with-ignored-suppression/tests/Test.php", "language": "php", "file_size": 1043, "cut_index": 513, "middle_length": 229 }
* 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\Event; use PHPUnit\Framework\Attributes\BackupGlobals; use PHPUnit\Fram...
One(): void { $GLOBALS['excludedVar'] = 'should not be backed up'; $this->assertTrue(true); } public function testTwo(): void { $this->assertSame('should not be backed up', $GLOBALS['excludedVar'] ?? null);
ListTest extends TestCase { public function test
{ "filepath": "tests/end-to-end/event/_files/BackupGlobalsWithExcludeListTest.php", "language": "php", "file_size": 897, "cut_index": 547, "middle_length": 52 }
e(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\Event; use Iterator; use PHPUnit\Framework\Attri...
$this->position++; } public function key(): float { return 0.1; } public function valid(): bool { return $this->position === 0;
plements Iterator { private int $position; public function current(): string { return 'value'; } public function next(): void {
{ "filepath": "tests/end-to-end/event/_files/DataProviderInvalidKeyTest.php", "language": "php", "file_size": 1256, "cut_index": 524, "middle_length": 229 }
e(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\Event; use PHPUnit\Framework\Attributes\Depends;...
ndsUsingDeepClone('testProducer')] public function testDeepCloneConsumer(stdClass $obj): void { $this->assertSame('original', $obj->value); } #[DependsUsingShallowClone('testProducer')] public function testShallowCloneConsumer(
alueCloningTest extends TestCase { public function testProducer(): stdClass { $obj = new stdClass; $obj->value = 'original'; $this->assertTrue(true); return $obj; } #[Depe
{ "filepath": "tests/end-to-end/event/_files/DependencyReturnValueCloningTest.php", "language": "php", "file_size": 1252, "cut_index": 524, "middle_length": 229 }
* 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\Event; use const E_USER_DEPRECATED; use function error_get_last; use fu...
sage', E_USER_DEPRECATED); $this->assertTrue(true); } public function testDeprecatedSuppressedErrorGetLast(): void { $this->assertNull(error_get_last()); @trigger_error('message', E_USER_DEPRECATED); $this->ass
ge', E_USER_DEPRECATED); @trigger_error('mes
{ "filepath": "tests/end-to-end/event/_files/DeprecatedFeatureTest.php", "language": "php", "file_size": 893, "cut_index": 547, "middle_length": 52 }
?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\Metadata\Attribute; use PHPUnit\Frame...
'text')] public function testOne(): void { } #[TestDoxFormatter('methodName')] public function testTwo(): void { } #[TestDoxFormatterExternal('ClassName', 'methodName')] public function testThree(): void { } }
class TestDoxTest extends TestCase { #[TestDox(
{ "filepath": "tests/_files/Metadata/Attribute/tests/TestDoxTest.php", "language": "php", "file_size": 821, "cut_index": 513, "middle_length": 52 }
hp 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\Metadata\Attribute; use PHPUnit\Framewo...
ibute')] #[UsesClass(Example::class)] #[UsesClassesThatExtendClass(Example::class)] #[UsesClassesThatImplementInterface(Example::class)] #[UsesTrait(ExampleTrait::class)] #[UsesMethod(Example::class, 'method')] #[UsesFunction('f')] final class UsesTest ext
unction; use PHPUnit\Framework\Attributes\UsesMethod; use PHPUnit\Framework\Attributes\UsesNamespace; use PHPUnit\Framework\Attributes\UsesTrait; use PHPUnit\Framework\TestCase; #[UsesNamespace('PHPUnit\TestFixture\Metadata\Attr
{ "filepath": "tests/_files/Metadata/Attribute/tests/UsesTest.php", "language": "php", "file_size": 1066, "cut_index": 515, "middle_length": 229 }
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; f...
#[DataProvider('providerForA')] public function testA(int $i): void { $this->assertGreaterThan(0, $i); } #[DataProvider('providerForB')] public function testB(int $i): void { $this->assertGreaterThan(0, $i); }
): array { return [[1], [2]]; }
{ "filepath": "tests/end-to-end/_files/DataProviderSkipWhenFilteredTest.php", "language": "php", "file_size": 869, "cut_index": 559, "middle_length": 52 }
* 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\...
tion provider(): iterable { yield 'foo2' => ['bar', 'baz']; } #[DataProvider('provider')] #[DataProviderExternal(self::class, 'externalProvider')] public function testWithDifferentProviderTypes($one, $two): void { $
oo' => ['bar', 'baz']; } public static func
{ "filepath": "tests/end-to-end/_files/DataProviderTest.php", "language": "php", "file_size": 887, "cut_index": 547, "middle_length": 52 }
hp 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\After...
oid { } #[Before(priority: 1)] protected function beforeWithPriority(): void { } #[After] protected function afterFirst(): void { } #[After] protected function afterSecond(): void { } #[After(
n(): void { } public function testOne(): void { $this->assertTrue(true); } #[Before] protected function beforeSecond(): void { } #[Before] protected function beforeFirst(): v
{ "filepath": "tests/end-to-end/_files/HookMethodsOrderTest.php", "language": "php", "file_size": 1077, "cut_index": 515, "middle_length": 229 }
tian@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 const E_USER_DEPRECATED; use const E_USER_NOTICE; use const E_USER_WARNING; use function trigger_error; use Exception; use PHPUnit\Fr...
estSuccessWithNotice(): void { trigger_error('notice message', E_USER_NOTICE); $this->assertTrue(true); } public function testSuccessWithWarning(): void { trigger_error('warning message', E_USER_WARNING);
estSuccessWithRisky(): void { } public function testSuccessWithDeprecation(): void { trigger_error('deprecation message', E_USER_DEPRECATED); $this->assertTrue(true); } public function t
{ "filepath": "tests/end-to-end/_files/OutcomesAndIssuesTest.php", "language": "php", "file_size": 3210, "cut_index": 614, "middle_length": 229 }
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\DataPr...
er(): iterable { yield ['Hello world!']; } #[RunInSeparateProcess] #[DataProvider('greetDataProvider')] public function testInIsolationWithProvider(string $expected): void { $this->assertSame($expected, 'Hello world
reetDataProvid
{ "filepath": "tests/end-to-end/_files/TestProcessIsolationWithDataProvider.php", "language": "php", "file_size": 800, "cut_index": 517, "middle_length": 14 }
<?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 ArrayAccess; final class Sampl...
return isset($this->container[$offset]); } public function offsetUnset($offset): void { unset($this->container[$offset]); } public function offsetGet($offset): mixed { return $this->container[$offset] ?? null;
): void { if (null === $offset) { $this->container[] = $value; } else { $this->container[$offset] = $value; } } public function offsetExists($offset): bool {
{ "filepath": "tests/_files/SampleArrayAccess.php", "language": "php", "file_size": 1003, "cut_index": 512, "middle_length": 229 }
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\Cove...
[UsesClass(CoveredClass::class)] #[Group('the-group')] #[Ticket('the-ticket')] #[Small] final class SmallGroupAnnotationsTest extends TestCase { #[Group('another-group')] #[Ticket('another-ticket')] public function testOne(): void { } }
ork\TestCase; #[CoversClass(CoveredClass::class)] #
{ "filepath": "tests/_files/SmallGroupAnnotationsTest.php", "language": "php", "file_size": 823, "cut_index": 514, "middle_length": 52 }
e(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\TestCase; use Throwable; ...
; } protected function assertPostConditions(): void { print __METHOD__ . "\n"; } protected function tearDown(): void { print __METHOD__ . "\n"; } public function testOne(): void { print __METHO
ass(): void { print __METHOD__ . "\n"; } protected function setUp(): void { print __METHOD__ . "\n"; } protected function assertPreConditions(): void { print __METHOD__ . "\n"
{ "filepath": "tests/_files/TemplateMethodsTest.php", "language": "php", "file_size": 1306, "cut_index": 524, "middle_length": 229 }
n <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 Iterator; final class TestIterator implements Iterator { private array $array; private int $position = 0; publi...
position]); } public function key(): int|string { return $this->position; } public function current(): mixed { return $this->array[$this->position]; } public function next(): void { $this->posi
bool { return isset($this->array[$this->
{ "filepath": "tests/_files/TestIterator.php", "language": "php", "file_size": 930, "cut_index": 606, "middle_length": 52 }
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\After; u...
#[AfterClass(priority: 6)] public static function afterLastTest(): void { } #[Before(priority: 2)] protected function beforeEachTest(): void { } #[PreCondition(priority: 3)] protected function preConditions(): void
ramework\Attributes\PreCondition; use PHPUnit\Framework\TestCase; final class TestWithHookMethodsPrioritizedTest extends TestCase { #[BeforeClass(priority: 1)] public static function beforeFirstTest(): void { }
{ "filepath": "tests/_files/TestWithHookMethodsPrioritizedTest.php", "language": "php", "file_size": 1195, "cut_index": 518, "middle_length": 229 }
art 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 Generator; use PHPUnit\Framework\Attributes\DataProvider; final class VariousIter...
der(): WrapperIteratorAggregate { return new WrapperIteratorAggregate([ ['G'], ['H'], ['I'], ]); } public static function asArrayProvider(): array { return [ ['S'],
['C'], ]; } public static function asIteratorStaticProvider(): Generator { yield ['D']; yield ['E']; yield ['F']; } public static function asTraversableStaticProvi
{ "filepath": "tests/_files/VariousIterableDataProviderTest.php", "language": "php", "file_size": 2055, "cut_index": 563, "middle_length": 229 }
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\Depends;...
tTrue(true); } #[DependsUsingShallowClone('testOne')] public function testFour(): void { $this->assertTrue(true); } #[Depends('doesNotExist')] public function testHandlesDependencyOnTestMethodThatDoesNotExist(): void
his->assertTrue(false); } #[Depends('testOne')] public function testTwo(): void { $this->assertTrue(true); } #[Depends('testTwo')] public function testThree(): void { $this->asser
{ "filepath": "tests/_files/dependencies/DependencyFailureTest.php", "language": "php", "file_size": 1189, "cut_index": 518, "middle_length": 229 }