prefix stringlengths 512 512 | suffix stringlengths 256 256 | middle stringlengths 14 229 | meta dict |
|---|---|---|---|
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\Framework\... | ass]
public function beforeTests(): void
{
}
#[Before]
public function beforeTest(): void
{
}
#[PreCondition]
public function preCondition(): void
{
}
#[Test]
public function one(): void
{
}
| tion;
use PHPUnit\Framework\Attributes\PreCondition;
use PHPUnit\Framework\Attributes\Small;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
#[Small]
final class SmallTest extends TestCase
{
#[BeforeCl | {
"filepath": "tests/_files/Metadata/Attribute/tests/SmallTest.php",
"language": "php",
"file_size": 1213,
"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\DeprecatedAnnotationsTestFixture;
use PHPUnit\Fram... | stOne(): void
{
$this->assertTrue(true);
}
#[Before(priority: 1)]
protected function beforeMethodWithHighPriority(): void
{
}
#[Before(priority: -1)]
protected function beforeMethodWithLowPriority(): void
{
| ic function te | {
"filepath": "tests/end-to-end/_files/BeforeTestMethodWithPrioritizedAttributeTest.php",
"language": "php",
"file_size": 789,
"cut_index": 514,
"middle_length": 14
} |
that was distributed with this source code.
*/
namespace PHPUnit\TestFixture;
use Exception;
use PHPUnit\Framework\TestCase;
final class ExpectingExceptionsTest extends TestCase
{
public function test_expectException_and_expected_exception_is_thrown(): void
{
$this->expectException(Exception::class)... | ntains('message');
throw new Exception('message');
}
public function test_expectExceptionMessage_and_exception_is_thrown_and_has_expected_message(): void
{
$this->expectExceptionMessageIsOrContains('message');
throw n | public function test_expectException_and_expectExceptionMessage_and_expected_exception_is_thrown_and_has_expected_message(): void
{
$this->expectException(Exception::class);
$this->expectExceptionMessageIsOrCo | {
"filepath": "tests/end-to-end/_files/ExpectingExceptionsTest.php",
"language": "php",
"file_size": 6216,
"cut_index": 716,
"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\After;
... | #[Before(priority: 1)]
protected function beforeWithPriorityInParent(): void
{
}
#[After]
protected function afterInParent(): void
{
}
#[After(priority: 1)]
protected function afterWithPriorityInParent(): void
|
{
}
| {
"filepath": "tests/end-to-end/_files/HookMethodsOrderTestCase.php",
"language": "php",
"file_size": 797,
"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 PHPUnit\Framework\Attributes\Cove... | [UsesClass(CoveredClass::class)]
#[Group('the-group')]
#[Ticket('the-ticket')]
#[Small]
final class SmallGroupAttributesTest extends TestCase
{
#[Group('another-group')]
#[Ticket('another-ticket')]
public function testOne(): void
{
}
}
| ork\TestCase;
#[CoversClass(CoveredClass::class)]
# | {
"filepath": "tests/_files/SmallGroupAttributesTest.php",
"language": "php",
"file_size": 822,
"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 DateTimeImmutable;
use PHPUnit\Framework\At... | s a custom test description')]
public function testThree(): void
{
}
#[TestDox('This is a custom test description with placeholders $a $b $f $i $s $o $stdClass $enum $backedEnum $n $empty $default')]
public function testFour(array $a, | mutable $date): string
{
return 'This is a custom description: ' . $date->format('Y-m-d');
}
public function testOne(): void
{
}
public function testTwo(): void
{
}
#[TestDox('This i | {
"filepath": "tests/_files/TestDoxTest.php",
"language": "php",
"file_size": 1396,
"cut_index": 524,
"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 function current;
use function key;
use function next;
use function reset;
use Iterator;
final class... | ublic function next(): void
{
next($this->data);
}
public function key(): null|int|string
{
return key($this->data);
}
public function valid(): bool
{
return key($this->data) !== null;
}
public | {
return current($this->data);
}
p | {
"filepath": "tests/_files/TestIterator2.php",
"language": "php",
"file_size": 957,
"cut_index": 582,
"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\MockObject;
class ExtendableClass
{
pu... | : bool
{
return $this->doSomethingElse();
}
public function doSomethingElse(): bool
{
return false;
}
final public function finalMethod(): void
{
}
private function privateMethod(): void
{
}
}
| doSomething() | {
"filepath": "tests/_files/mock-object/ExtendableClass.php",
"language": "php",
"file_size": 788,
"cut_index": 518,
"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\Metadata\Attribute;
use PHPUnit\Frame... | true);
}
#[TestWithJson('[1, 2, 3]')]
public function testTwo($one, $two, $three): void
{
$this->assertTrue(true);
}
#[TestWithJson('[1, 2, 3]', 'Name2')]
public function testTwoWithName($one, $two, $three): void
{ | tion testOne($one, $two, $three): void
{
$this->assertTrue(true);
}
#[TestWith([1, 2, 3], 'Name1')]
public function testOneWithName($one, $two = null, $three = null): void
{
$this->assertTrue( | {
"filepath": "tests/_files/Metadata/Attribute/tests/TestWithTest.php",
"language": "php",
"file_size": 1040,
"cut_index": 513,
"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... | iterable
{
yield 'foo' => ['bar', 'baz'];
}
#[TestWith(['a', 'b'], 'foo')]
#[DataProviderExternal(self::class, 'provider')]
public function testWithDifferentProviderTypes($one, $two): void
{
$this->assertTrue(true) | on provider(): | {
"filepath": "tests/end-to-end/_files/TestWithAttributeAndExternalDataProviderTest.php",
"language": "php",
"file_size": 797,
"cut_index": 517,
"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\TestFixture;
use PHPUnit\Framework\Attributes\CoversNothing;
use PHPUnit\Framework\... | eturn [
[true],
[false],
];
}
#[DataProvider('provideData')]
public function testWithProvider(bool $value): void
{
$this->assertTrue(true);
}
public function testWithoutProvider(): void
| static function provideData(): array
{
r | {
"filepath": "tests/_files/SmallTestWithDataProvider.php",
"language": "php",
"file_size": 898,
"cut_index": 547,
"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 FooBarHandler;
use PHPUnit\Framework\Attributes\DataProvider;
use ... | FooBarHandler::class,
// ...
],
];
}
#[DataProvider('routesProvider')]
#[TestDox('Routes $url to $handler')]
public function testRoutesRequest(string $url, string $handler): void
{
| '/foo/bar' => [
'/foo/bar',
| {
"filepath": "tests/_files/RouterTest.php",
"language": "php",
"file_size": 893,
"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\TestFixture;
use PHPUnit\Framework\Attributes\After;
u... | Class]
public static function afterLastTestWithAttribute(): void
{
}
#[Before]
protected function beforeEachTestWithAttribute(): void
{
}
#[After]
protected function afterEachTestWithAttribute(): void
{
}
| ramework\Attributes\PreCondition;
use PHPUnit\Framework\TestCase;
final class TestWithHookMethodsTest extends TestCase
{
#[BeforeClass]
public static function beforeFirstTestWithAttribute(): void
{
}
#[After | {
"filepath": "tests/_files/TestWithHookMethodsTest.php",
"language": "php",
"file_size": 1184,
"cut_index": 518,
"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 const E_USER_DEPRECATED;
use function... | function testTwo(): void
{
trigger_error('foo', E_USER_DEPRECATED);
$this->assertTrue(true);
}
public function testThree(): void
{
trigger_error('foo', E_USER_DEPRECATED);
trigger_error('baz', E_USER_DEPREC | e
{
#[IgnoreDeprecations('bar')]
public function testOne(): void
{
trigger_error('foo', E_USER_DEPRECATED);
trigger_error('bar', E_USER_DEPRECATED);
$this->assertTrue(true);
}
public | {
"filepath": "tests/end-to-end/event/_files/IgnoreDeprecationsWithPatternTest.php",
"language": "php",
"file_size": 1326,
"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;
use function file_exists;
use function file_get_contents;
u... | public static $processId = self::INITIAL_PROCESS_ID;
public static function setUpBeforeClass(): void
{
if (file_exists(self::PROCESS_ID_FILE_PATH)) {
self::$parentProcessId = (int) file_get_contents(self::PROC | = __DIR__ . '/parent_process_id.txt';
public const int INITIAL_PARENT_PROCESS_ID = 0;
public const int INITIAL_PROCESS_ID = 1;
public static $parentProcessId = self::INITIAL_PARENT_PROCESS_ID;
| {
"filepath": "tests/end-to-end/regression/2724/SeparateClassRunMethodInNewProcessTest.php",
"language": "php",
"file_size": 1590,
"cut_index": 537,
"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 IssueTest6105;
use function header;
use function ob_get_cle... | [RequiresPhpExtension('xdebug')]
public function test_case_2_check(): void
{
ob_start();
header('X-Test: Testing');
print 'asd';
$content = ob_get_clean();
$this->assertSame('asd', $content);
$this-> | tes\RunInSeparateProcess;
use PHPUnit\Framework\TestCase;
#[CoversNothing]
class IssueTest6105 extends TestCase
{
public function test_1(): void
{
$this->assertTrue(true);
}
#[RunInSeparateProcess]
# | {
"filepath": "tests/end-to-end/regression/6105/IssueTest6105.php",
"language": "php",
"file_size": 1063,
"cut_index": 515,
"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\Issue6511;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\TestDox;
use PHPUnit\Framework\TestCase... | he a is $a, the b is $b, the c is $c.')]
#[DataProvider('provideOneCases')]
public function testOne($a, $b, $c): void
{
$this->assertSame('Alfa', $a);
$this->assertSame('Bravo', $b);
$this->assertSame('Charlie', $c);
| 'b' => 'Bravo',
];
}
#[TestDox('T | {
"filepath": "tests/end-to-end/regression/6511/Issue6511Test.php",
"language": "php",
"file_size": 919,
"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.
*/
namespace PHPUnit\TestFixture\Issue5949;
use PHPUnit\Framework\Attributes\Test... | his->assertTrue(true);
}
#[TestDox("Test 4. No dollar sign.\n")]
public function test4(): void
{
$this->assertTrue(true);
}
#[TestDox("Test 5. Dollar \$ sign.\n More text.\n")]
public function test5(): void
| ;
}
#[TestDox("Test 2. No dollar sign.\n")]
public function test2(): void
{
$this->assertTrue(true);
}
#[TestDox("Test 3. Dollar sign (\$).\n")]
public function test3(): void
{
$t | {
"filepath": "tests/end-to-end/regression/5949/Issue5949Test.php",
"language": "php",
"file_size": 1427,
"cut_index": 524,
"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 Exception;
use PHPUnit\Framework\Attr... | te the data");
}
#[Test]
#[DataProvider('shouldBeTrueDataProvider')]
#[Group('falseOnly')]
public function shouldBeTrue($testData): void
{
$this->assertTrue(true);
}
#[Test]
#[DataProvider('shouldBeFalseDataPro | ction shouldBeTrueDataProvider(): array
{
return [
[true],
[false],
];
}
public static function shouldBeFalseDataProvider(): array
{
throw new Exception("Can't crea | {
"filepath": "tests/end-to-end/regression/498/Issue498Test.php",
"language": "php",
"file_size": 1137,
"cut_index": 518,
"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\Issue2725;
use function getmypid;
use PHPU... | if ($GLOBALS[static::PID_VARIABLE] - getmypid() !== 0) {
print "\n@afterClass output - PID difference should be zero!";
}
unset($GLOBALS[static::PID_VARIABLE]);
}
public function testMethod1WithItsBeforeAndAfter( | LE = 'current_pid';
#[BeforeClass]
public static function showPidBefore(): void
{
$GLOBALS[static::PID_VARIABLE] = getmypid();
}
#[AfterClass]
public static function showPidAfter(): void
{
| {
"filepath": "tests/end-to-end/regression/2725/BeforeAfterClassPidTest.php",
"language": "php",
"file_size": 1245,
"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\Issue6599;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use RuntimeException;
final class Issue... | 'failure in setUp');
}
#[DataProvider('provider')]
public function testWithDataProvider(int $value): void
{
$this->assertGreaterThan(0, $value);
}
public function testWithoutDataProvider(): void
{
$this->assert | Up(): void
{
throw new RuntimeException( | {
"filepath": "tests/end-to-end/regression/6599/Issue6599Test.php",
"language": "php",
"file_size": 934,
"cut_index": 606,
"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\TestFixture\Issue5822;
use const E_USER_DEPRECATED;
... | ertTrue(true);
}
private function callUserFuncExample(): void
{
call_user_func($this->exampleCallback(...));
}
private function exampleCallback(): void
{
trigger_error('My Deprecation Error', E_USER_DEPRECATED);
| $this->callUserFuncExample();
$this->ass | {
"filepath": "tests/end-to-end/regression/5822/tests/Issue5822Test.php",
"language": "php",
"file_size": 830,
"cut_index": 516,
"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 const PHP_OUTPUT_HANDLER_FLUSHABLE;
u... | $this->expectOutputString('hello');
print 'hello';
ob_flush();
}
public function testBufferSubstitutionDetected(): void
{
ob_end_clean();
ob_start();
$this->assertTrue(true);
}
public fu | testOutputCapturedAfterObClean(): void
{
$this->expectOutputString('hello');
print 'hel';
ob_clean();
print 'hello';
}
public function testOutputCapturedAfterObFlush(): void
{
| {
"filepath": "tests/end-to-end/regression/5851/Issue5851Test.php",
"language": "php",
"file_size": 1170,
"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;
use function defined;
use PHPUnit\F... | ly in main process constant should be available and
* no errors should be yielded by reload of included files.
*/
#[RunInSeparateProcess]
public function testSomethingElse(): void
{
$this->assertTrue(defined('TEST_CONSTANT')); | se
{
/**
* Set constant in main process.
*/
public function testSomething(): void
{
include __DIR__ . '/constant.inc';
$this->assertTrue(true);
}
/**
* Constant defined previous | {
"filepath": "tests/end-to-end/regression/2158/Issue2158Test.php",
"language": "php",
"file_size": 1006,
"cut_index": 512,
"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\Issue4391;
use Exception;
use PHPUnit\Fra... | Test extends TestCase
{
#[RequiresPhpunit('< 10.0.0')]
public function testOne(): void
{
throw new Exception('message');
}
#[RequiresPhpunit('< 10.0.0')]
public function testTwo(): void
{
throw new Exception('me | rocessesMethod | {
"filepath": "tests/end-to-end/regression/4391/RunTestsInSeparateProcessesMethodTest.php",
"language": "php",
"file_size": 804,
"cut_index": 517,
"middle_length": 14
} |
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.
*/
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\At... | ];
}
#[DataProvider('fooDataProvider')]
public function testFoo(string $input): void
{
$this->assertNotEmpty($input);
}
#[Depends('testFoo')]
public function testBar(): void
{
$this->assertTrue(true);
| > ['Hello'],
'foo 2' => ['World'],
| {
"filepath": "tests/end-to-end/regression/5178/Issue5178Test.php",
"language": "php",
"file_size": 830,
"cut_index": 516,
"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\Issue6451;
use PHPUnit\Framework\Attribute... | $this->assertTrue(true);
}
#[RequiresPhpExtension('json', '>= 1')]
public function testIncompletePhpExtensionVersion(): void
{
$this->assertTrue(true);
}
#[RequiresPhp('>= 8.0.0')]
#[RequiresPhpunit('>= 10.0.0')] | ase
{
#[RequiresPhp('>= 8')]
public function testIncompletePhpVersion(): void
{
$this->assertTrue(true);
}
#[RequiresPhpunit('>= 10')]
public function testIncompletePhpunitVersion(): void
{
| {
"filepath": "tests/end-to-end/regression/6451/Issue6451Test.php",
"language": "php",
"file_size": 1148,
"cut_index": 518,
"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\Issue5891;
use IteratorAggregate;
use PDOExcepti... | e($exception, 'HY000');
$this->assertIsString($exception->getCode());
$iterator = new class($exception) implements IteratorAggregate
{
public PDOException $exception;
public function __construct($exception | ds TestCase
{
public function testOne(): void
{
$exception = new PDOException;
$reflector = new ReflectionClass($exception);
$property = $reflector->getProperty('code');
$property->setValu | {
"filepath": "tests/end-to-end/regression/5965/Issue5965Test.php",
"language": "php",
"file_size": 1272,
"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\Issue5891;
use PHPUnit\Framework\TestCase;
fina... | $mock->foo(1, 2, 3);
}
public function testTwoParametersAndVariadicParam(): void
{
$mock = $this->createMock(TwoParametersAndArgumentList::class);
$mock
->expects($this->once())
->method('foo')
| >once())
->method('foo')
->with($this->callback(static function (...$items): bool
{
self::assertSame([1, 2, 3], $items);
return true;
}));
| {
"filepath": "tests/end-to-end/regression/5891/Issue5891Test.php",
"language": "php",
"file_size": 1457,
"cut_index": 524,
"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\Issue6408;
use PHPUnit\Framework\Attribute... | sertTypes();
}
public static function gatherAssertTypes(): array
{
throw new RuntimeException('a users exception from data-provider context');
}
#[DataProvider('provideData')]
public function testFoo(): void
{
}
}
| self::gatherAs | {
"filepath": "tests/end-to-end/regression/6408/Issue6408Test.php",
"language": "php",
"file_size": 788,
"cut_index": 518,
"middle_length": 14
} |
are(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\ExecutionOrder\Defects;
use PHPUnit\Framework\... | rue);
}
public function testTwo(): void
{
$this->assertTrue(false);
}
public function testThree(): void
{
throw new RuntimeException('message');
}
public function testFour(): void
{
$this->asse | ->assertTrue(t | {
"filepath": "tests/end-to-end/execution-order/fixture/test-classes-with-defects/BarTest.php",
"language": "php",
"file_size": 814,
"cut_index": 522,
"middle_length": 14
} |
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\Issue6595;
use PHPUnit\Framework\Attribut... | }
public static function setUpBeforeClass(): void
{
self::fail('failure in setUpBeforeClass');
}
#[DataProvider('provider')]
public function testOne(int $value): void
{
$this->assertGreaterThan(0, $value);
}
}
| [
[1],
[2],
];
| {
"filepath": "tests/end-to-end/regression/6595/FailureInSetUpBeforeClassWithDataProviderTest.php",
"language": "php",
"file_size": 825,
"cut_index": 517,
"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\Issue6279;
use const E_USER_DEPRECATED;
use const E_USER_WAR... |
public static function dataWith2Deprecations(): iterable
{
@trigger_error('first', E_USER_DEPRECATED);
@trigger_error('second', E_USER_DEPRECATED);
@trigger_error('warning', E_USER_WARNING);
yield [true];
}
| work\TestCase;
class TriggersDeprecationInDataProvider1Test extends TestCase
{
public static function dataProvider(): iterable
{
@trigger_error('some deprecation', E_USER_DEPRECATED);
yield [true];
} | {
"filepath": "tests/end-to-end/regression/6279/TriggersDeprecationInDataProvider1Test.php",
"language": "php",
"file_size": 1791,
"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\Issue6279;
use const E_USER_DEPRECATED;
use function trigger... | public static function dataProvider2(): iterable
{
@trigger_error('some deprecation 2', E_USER_DEPRECATED);
yield [true];
}
public static function dataProvider3(): iterable
{
@trigger_error('some deprecation 3', E | rsDeprecationInDataProviderUsingIgnoreDeprecationsTest extends TestCase
{
public static function dataProvider1(): iterable
{
@trigger_error('some deprecation', E_USER_DEPRECATED);
yield [true];
}
| {
"filepath": "tests/end-to-end/regression/6279/TriggersDeprecationInDataProviderUsingIgnoreDeprecationsTest.php",
"language": "php",
"file_size": 1882,
"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;
use Exception;
use PHPUnit\Framework\Att... | w new Exception;
}
public function testDependee(): void
{
$this->assertTrue(true);
}
#[Depends('testDependee')]
#[DataProvider('dependentProvider')]
public function testDependent($a): void
{
$this->assertTr | {
thro | {
"filepath": "tests/end-to-end/regression/765/Issue765Test.php",
"language": "php",
"file_size": 805,
"cut_index": 517,
"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\TestFixture\DeprecationCollector;
use const E_USER_DEPRECATED;
use function trigger... | $this->expectUserDeprecationMessage('first deprecation');
trigger_error('first deprecation', E_USER_DEPRECATED);
}
#[IgnoreDeprecations]
public function testSecondDoesNotSeeFirstDeprecation(): void
{
$this->expectU | function testFirstTriggersDeprecation(): void
{
| {
"filepath": "tests/end-to-end/_files/DeprecationCollectorResetTest.php",
"language": "php",
"file_size": 907,
"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 const E_USER_DEPRECATED;
use function... | E_USER_DEPRECATED);
$this->assertTrue(true);
}
#[IgnoreDeprecations]
public function testOneErrorGetLast(): void
{
$this->assertNull(error_get_last());
trigger_error('message', E_USER_DEPRECATED);
$this->a | gnoreDeprecations]
public function testOne(): void
{
trigger_error('message', E_USER_DEPRECATED);
$this->assertTrue(true);
}
public function testTwo(): void
{
trigger_error('message', | {
"filepath": "tests/end-to-end/event/_files/IgnoreDeprecationsTest.php",
"language": "php",
"file_size": 1256,
"cut_index": 524,
"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\Event\ErrorHandlerCanBeDisabled;
use const E_USER_WARNING;
use function error_get_l... | error_get_last();
throw new Exception($error['message']);
}
return $stream_handle;
}
public function methodB(): ?array
{
@trigger_error('Triggering', E_USER_WARNING);
return error_get_last();
| f ($stream_handle === false) {
$error = | {
"filepath": "tests/end-to-end/event/_files/error-handler-can-be-disabled/src/Foo.php",
"language": "php",
"file_size": 871,
"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\TestFixture\Event\SkipInBeforeClass;
use function range;
use PHPU... | [true];
}
}
public static function setUpBeforeClass(): void
{
self::markTestSkipped('Skipped in before class');
}
#[DataProvider('provideData')]
public function test1(bool $bool): void
{
$this->assertTr | oreach (range(1, 100) as $item) {
yield | {
"filepath": "tests/end-to-end/event/_files/skip-in-before-class/SkippedBeforeClassTest.php",
"language": "php",
"file_size": 856,
"cut_index": 529,
"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\ErrorHandler\UserDeprecation;
use const E_... |
public function testDirect(): void
{
(new FirstPartyClass)->callThirdParty();
$this->assertTrue(true);
}
public function testThirdPartyCallsFirstParty(): void
{
(new ThirdPartyClass)->callFirstParty();
| gger_error('deprecation in test code', E_USER_DEPRECATED);
$this->assertTrue(true);
}
public function testSelf(): void
{
(new FirstPartyClass)->triggerSelf();
$this->assertTrue(true);
}
| {
"filepath": "tests/end-to-end/error-handler/_files/user-deprecation/tests/UserDeprecationTest.php",
"language": "php",
"file_size": 1166,
"cut_index": 518,
"middle_length": 229
} |
are(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\ExecutionOrder\Defects;
use PHPUnit\Framework\... | rue);
}
public function testTwo(): void
{
$this->assertTrue(false);
}
public function testThree(): void
{
throw new RuntimeException('message');
}
public function testFour(): void
{
$this->asse | ->assertTrue(t | {
"filepath": "tests/end-to-end/execution-order/fixture/test-methods-with-defects/FooTest.php",
"language": "php",
"file_size": 814,
"cut_index": 522,
"middle_length": 14
} |
are(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\ExecutionOrder\Defects;
use PHPUnit\Framework\... | rue);
}
public function testTwo(): void
{
$this->assertTrue(false);
}
public function testThree(): void
{
throw new RuntimeException('message');
}
public function testFour(): void
{
$this->asse | ->assertTrue(t | {
"filepath": "tests/end-to-end/execution-order/fixture/test-classes-with-defects/BazTest.php",
"language": "php",
"file_size": 814,
"cut_index": 522,
"middle_length": 14
} |
nn <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\Issue6279;
use const E_USER_DEPRECATED;
use function trigger_error;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Fr... | igger_error('some deprecation 1', E_USER_DEPRECATED);
yield [true];
}
#[Test]
#[DataProvider('dataProvider')]
#[IgnoreDeprecations]
public function methodWithSameNameThanInAnotherTest(bool $value): void
{
$this->as | function dataProvider(): iterable
{
@tr | {
"filepath": "tests/end-to-end/regression/6279/TriggersDeprecationInDataProvider2Test.php",
"language": "php",
"file_size": 940,
"cut_index": 606,
"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\TestFixture\Event;
use PHPUnit\Framework\Attributes\DoesNotPerformAssertions;
use PHPUnit\Frame... | tions();
}
#[DoesNotPerformAssertions]
public function testThree(): void
{
$this->assertTrue(true);
}
public function testFour(): void
{
$this->expectNotToPerformAssertions();
$this->assertTrue(true);
| ): void
{
$this->expectNotToPerformAsser | {
"filepath": "tests/end-to-end/event/_files/ExpectedAndUnexpectedAssertionsTest.php",
"language": "php",
"file_size": 875,
"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\TestFixture\Event;
use PHPUnit\Framework\Attributes\D... | rue, 'value2' => true],
['value3' => true, 'value4' => true],
];
}
#[DataProvider('values')]
public function testSuccess(bool $value1, bool $value2): void
{
$this->assertTrue($value1);
$this->assertTrue( | ['value1' => t | {
"filepath": "tests/end-to-end/event/_files/InvalidParameterNameDataProviderTest.php",
"language": "php",
"file_size": 805,
"cut_index": 517,
"middle_length": 14
} |
clare(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 const E_USER_WARNING;
use functio... | er_error('message', E_USER_WARNING);
}
public function testSuppressedUserWarningErrorGetLast(): void
{
$this->assertNull(error_get_last());
@trigger_error('message', E_USER_WARNING);
$this->assertIsArray(error_get_last( | {
$this->assertTrue(true);
@trigg | {
"filepath": "tests/end-to-end/event/_files/SuppressedUserWarningTest.php",
"language": "php",
"file_size": 840,
"cut_index": 520,
"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\TestFixture\Event;
use PHPUnit\Framework\AssertionFa... | ception('setup failed');
}
public function testOne(): void
{
$this->assertTrue(true);
}
protected function transformException(Throwable $t): Throwable
{
return new AssertionFailedError($t->getMessage(), 0, $t);
| tion setUp(): void
{
throw new RuntimeEx | {
"filepath": "tests/end-to-end/event/_files/TransformExceptionToAssertionFailedErrorDuringPreparationTest.php",
"language": "php",
"file_size": 829,
"cut_index": 516,
"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\Event;
use const E_USER_NOTICE;
use funct... | );
trigger_error('message', E_USER_NOTICE);
}
public function testUserNoticeErrorGetLast(): void
{
$this->assertNull(error_get_last());
trigger_error('message', E_USER_NOTICE);
$this->assertIsArray(error_get_la | ssertTrue(true | {
"filepath": "tests/end-to-end/event/_files/UserNoticeTest.php",
"language": "php",
"file_size": 802,
"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\Event\ErrorHandlerCanBeDisabled;
use function restore_error_h... | eption::class);
$this->expectExceptionMessageIsOrContains('Failed to open stream');
(new Foo)->methodA($fileName);
}
#[WithoutErrorHandler]
public function testMethodB(): void
{
$this->assertSame('Triggering', (new | ;
final class FooTest extends TestCase
{
#[WithoutErrorHandler]
public function testMethodA(): void
{
$fileName = tempnam(sys_get_temp_dir(), 'RLT') . '/missing/directory';
$this->expectException(Exc | {
"filepath": "tests/end-to-end/event/_files/error-handler-can-be-disabled/tests/FooTest.php",
"language": "php",
"file_size": 1535,
"cut_index": 537,
"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\ErrorHandler;
use const E_USER_DEPRECATED;
use f... | llback(): void
{
array_map(static function (int $value): int
{
@trigger_error('deprecation from array_map callback', E_USER_DEPRECATED);
return $value;
}, [1]);
$this->assertTrue(true);
}
}
| sideArrayMapCa | {
"filepath": "tests/end-to-end/error-handler/_files/UserDeprecationViaArrayMapTest.php",
"language": "php",
"file_size": 794,
"cut_index": 524,
"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\Issue6222;
use PHPUnit\Framework\Attributes\Dat... | GreaterThan(0, $x);
}
#[Depends('testTwoCasesPassing')]
public function testDependingOnTwoCasesPassing(): void
{
$this->assertTrue(true);
}
#[DataProvider('provider')]
public function testOneCasePassing(int $x): void
| [1];
yield [2];
}
public function testOne(): void
{
$this->assertTrue(false);
}
#[DataProvider('provider')]
public function testTwoCasesPassing(int $x): void
{
$this->assert | {
"filepath": "tests/end-to-end/regression/6222/Issue6222Test.php",
"language": "php",
"file_size": 1476,
"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;
use function restore_error_handler;
use function restore_exc... | set_error_handler($this->errorHandler(...));
$this->assertTrue(false);
}
public function testRemovedErrorHandler(): void
{
restore_error_handler();
$this->assertTrue(false);
}
public function testAddedA | estAddedAndRemovedErrorHandler(): void
{
set_error_handler($this->errorHandler(...));
restore_error_handler();
$this->assertTrue(true);
}
public function testAddedErrorHandler(): void
{
| {
"filepath": "tests/end-to-end/regression/5845/Issue5845Test.php",
"language": "php",
"file_size": 1854,
"cut_index": 537,
"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\Event;
use PHPUnit\Event\Facade as EventFacade;
use PHPUnit\Framework\Attributes\DataPr... | ts(),
'warning message',
);
$this->assertTrue(true);
}
#[IgnorePhpunitWarnings('warning message')]
public function testPhpunitWarningWithExactMessage(): void
{
EventFacade::emitter()->testTriggeredPhpun | r(): iterable
{
yield [true];
}
#[IgnorePhpunitWarnings]
public function testPhpunitWarning(): void
{
EventFacade::emitter()->testTriggeredPhpunitWarning(
$this->valueObjectForEven | {
"filepath": "tests/end-to-end/event/_files/PhpunitWarningIgnoredTest.php",
"language": "php",
"file_size": 2275,
"cut_index": 563,
"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\Event;
use const E_USER_WARNING;
use function error_get_last... | ger_error('message', E_USER_WARNING);
}
public function testUserWarningErrorGetLast(): void
{
$this->assertNull(error_get_last());
trigger_error('message', E_USER_WARNING);
$this->assertIsArray(error_get_last());
}
|
trig | {
"filepath": "tests/end-to-end/event/_files/UserWarningTest.php",
"language": "php",
"file_size": 808,
"cut_index": 536,
"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\ExecutionOrder\XmlDependsDefectsDuratio... | 'testTwo')]
public function testOne(): void
{
$this->assertTrue(true);
}
public function testTwo(): void
{
$this->assertTrue(true);
}
public function testThree(): void
{
$this->assertTrue(false);
| #[Depends( | {
"filepath": "tests/end-to-end/execution-order/fixture/xml-depends-defects-duration-ascending/FooTest.php",
"language": "php",
"file_size": 790,
"cut_index": 514,
"middle_length": 14
} |
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\Event;
use const E_USER_DEPRECATED;
use f... | s('foo')]
#[IgnoreDeprecations('bar')]
public function testOne(): void
{
trigger_error('foo', E_USER_DEPRECATED);
trigger_error('bar', E_USER_DEPRECATED);
trigger_error('baz', E_USER_DEPRECATED);
$this->assertTr | oreDeprecation | {
"filepath": "tests/end-to-end/event/_files/IgnoreDeprecationsWithMultiplePatternsTest.php",
"language": "php",
"file_size": 805,
"cut_index": 517,
"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\TestFixture\Event;
use PHPUnit\Framework\TestCase;
final class TemplateMethodsTest... | (): void
{
}
protected function assertPostConditions(): void
{
}
protected function tearDown(): void
{
}
public function testOne(): void
{
$this->assertTrue(true);
}
public function testTwo(): voi | {
}
protected function assertPreConditions | {
"filepath": "tests/end-to-end/event/_files/TemplateMethodsTest.php",
"language": "php",
"file_size": 904,
"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\TestFixture\Event;
use const E_USER_NOTICE;
use function er... | or('message', E_USER_NOTICE);
}
public function testSuppressedUserNoticeErrorGetLast(): void
{
$this->assertNull(error_get_last());
@trigger_error('message', E_USER_NOTICE);
$this->assertIsArray(error_get_last());
} | $this->assertTrue(true);
@trigger_err | {
"filepath": "tests/end-to-end/event/_files/SuppressedUserNoticeTest.php",
"language": "php",
"file_size": 834,
"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\ExecutionOrder\SkippedAndFailing;
use PHP... | }
public function testTwo(): void
{
$this->markTestSkipped('message');
}
public function testThree(): void
{
$this->assertTrue(false);
}
public function testFour(): void
{
$this->assertTrue(true | tTrue(true);
| {
"filepath": "tests/end-to-end/execution-order/fixture/test-methods-with-skipped-and-failing/FooTest.php",
"language": "php",
"file_size": 798,
"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\Issue6115;
use PHPUnit\Framework\Attri... | turn [
[
Enumeration::A,
],
];
}
#[DataProvider('provider')]
#[TestDox('$enumeration')]
public function testOne(Enumeration $enumeration): void
{
$this->assertTrue(true);
}
}
| c static function provider(): array
{
re | {
"filepath": "tests/end-to-end/regression/6115/Issue6115Test.php",
"language": "php",
"file_size": 822,
"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\TestDox;
use PHPUnit\Framework\Attributes\DataPr... | true,
],
];
}
#[DataProvider('provider')]
#[TestDox('Text from method-level TestDox metadata for successful test')]
public function testSomethingThatWorks(string $a, int $b, float $c, array $d, bool $e): v | Test extends TestCase
{
public static function provider(): array
{
return [
'data set name' => [
'string',
0,
0.0,
['key' => 'value'],
| {
"filepath": "tests/end-to-end/testdox/_files/DataProviderWithStringDataSetNameAndMetadataTest.php",
"language": "php",
"file_size": 1401,
"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\TestDox;
use PHPUnit\Framework\Attributes\DataProvider;
use P... |
true,
Foo::BAR,
Bar::FOO,
],
];
}
#[DataProvider('provider')]
#[TestDox('Text from method-level TestDox metadata for successful test with placeholders ($a, $b, $c, $d, $e, $f | ersTest extends TestCase
{
public static function provider(): array
{
return [
'data set name' => [
'string',
0,
0.0,
['key' => 'value'], | {
"filepath": "tests/end-to-end/testdox/_files/DataProviderWithStringDataSetNameAndMetadataWithPlaceholdersTest.php",
"language": "php",
"file_size": 1595,
"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\TestDox;
use PHPUnit\Framework\Attributes\... | tion testSomethingThatWorks(string $a, int $b, float $c, array $d, bool $e): void
{
$this->assertTrue(true);
}
#[DataProvider('provider')]
public function testSomethingThatDoesNotWork(string $a, int $b, float $c, array $d, bool $e) | 'data set name' => [
'string',
0,
0.0,
['key' => 'value'],
true,
],
];
}
#[DataProvider('provider')]
public func | {
"filepath": "tests/end-to-end/testdox/_files/DataProviderWithStringDataSetNameTest.php",
"language": "php",
"file_size": 1142,
"cut_index": 518,
"middle_length": 229
} |
clare(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\TestDox;
use PHPUnit\Framework\Attributes\Da... | static function provider(): array
{
return [
['string'],
];
}
#[DataProvider('provider')]
#[TestDoxFormatter('formatter')]
public function testOne(string $value): void
{
$this->assertTrue(true);
| list<array{0: non-empty-string}>
*/
public | {
"filepath": "tests/end-to-end/testdox/_files/FormatterMethodDoesNotExistTest.php",
"language": "php",
"file_size": 836,
"cut_index": 520,
"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\TestDox;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\TestDoxFormatter;... | ['string'],
];
}
#[DataProvider('provider')]
#[TestDoxFormatter('formatter')]
public function testOne(string $value): void
{
$this->assertTrue(true);
}
private static function formatter(string $value): st | tion provider(): array
{
return [
| {
"filepath": "tests/end-to-end/testdox/_files/FormatterMethodIsNotPublicTest.php",
"language": "php",
"file_size": 947,
"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\TestDox;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\TestDoxFormatter;
use PHPUnit\Framework\T... | ];
}
public function formatter(string $value): string
{
return 'formatted ' . $value;
}
#[DataProvider('provider')]
#[TestDoxFormatter('formatter')]
public function testOne(string $value): void
{
$this->a | {
return [
['string'],
| {
"filepath": "tests/end-to-end/testdox/_files/FormatterMethodIsNotStaticTest.php",
"language": "php",
"file_size": 939,
"cut_index": 606,
"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\TestDox;
use Exception;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Te... | return [
['string'],
];
}
public static function formatter(string $value): string
{
throw new Exception('message');
}
#[DataProvider('provider')]
#[TestDoxFormatter('formatter')]
public function | public static function provider(): array
{
| {
"filepath": "tests/end-to-end/testdox/_files/FormatterMethodThrowsExceptionTest.php",
"language": "php",
"file_size": 967,
"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\TestDox;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\TestDoxFormatter;
use PHPUnit\Framework\T... | ublic static function formatter(string $value): string
{
return 'formatted ' . $value;
}
#[DataProvider('provider')]
#[TestDoxFormatter('formatter')]
public function testOne(string $value): void
{
$this->assertTrue( | rn [
['string'],
];
}
p | {
"filepath": "tests/end-to-end/testdox/_files/FormatterTest.php",
"language": "php",
"file_size": 929,
"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\TestDox;
use PHPUnit\Framework\Attrib... | public static function formatter(string $_dataName, string $value): string
{
return $_dataName . ': ' . $value;
}
#[DataProvider('provider')]
#[TestDoxFormatter('formatter')]
public function testOne(string $value): void
| -array<non-empty-string, array{0: non-empty-string}>
*/
public static function provider(): array
{
return [
'first dataset' => ['one'],
'second dataset' => ['two'],
];
}
| {
"filepath": "tests/end-to-end/testdox/_files/FormatterWithDataNameTest.php",
"language": "php",
"file_size": 1048,
"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\TestDox;
use PHPUnit\Framework\Attributes\TestDox;
use PHPUnit\Framewor... |
$this->assertTrue(true);
}
#[TestDox('Text from method-level TestDox metadata for failing test')]
public function testSomethingThatDoesNotWork(): void
{
/* @noinspection PhpUnitAssertTrueWithIncompatibleTypeArgumentInspect | public function testSomethingThatWorks(): void
{ | {
"filepath": "tests/end-to-end/testdox/_files/MetadataTest.php",
"language": "php",
"file_size": 904,
"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\TestDox;
use const E_USER_DEPRECATED;
use const ... | gger_error('message', E_USER_DEPRECATED);
}
public function testSuccessButNotice(): void
{
$this->assertTrue(true);
trigger_error('message', E_USER_NOTICE);
}
public function testSuccessButWarning(): void
{
| tSuccess(): void
{
$this->assertTrue(true);
}
public function testSuccessButRisky(): void
{
}
public function testSuccessButDeprecation(): void
{
$this->assertTrue(true);
tri | {
"filepath": "tests/end-to-end/testdox/_files/OutcomeAndIssuesTest.php",
"language": "php",
"file_size": 1471,
"cut_index": 524,
"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\Event\MyExtension;
use const PHP_EOL;
use... | e string $message;
public function __construct(string $message)
{
$this->message = $message;
}
public function notify(ExecutionFinished $event): void
{
print __METHOD__ . PHP_EOL;
print $this->message . PHP_EOL | r
{
privat | {
"filepath": "tests/end-to-end/extension-cli/_files/extension-bootstrap/src/MyExecutionFinishedSubscriber.php",
"language": "php",
"file_size": 797,
"cut_index": 517,
"middle_length": 14
} |
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\Event\MyExtension;
use PHPUnit\Runner\Ext... | n
{
public function bootstrap(Configuration $configuration, Facade $facade, ParameterCollection $parameters): void
{
$facade->registerSubscriber(
new MyExecutionFinishedSubscriber(
'the-message',
),
| ments Extensio | {
"filepath": "tests/end-to-end/extension-cli/_files/extension-bootstrap/src/MyExtensionBootstrap.php",
"language": "php",
"file_size": 805,
"cut_index": 517,
"middle_length": 14
} |
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\Event\MyExtension;
use const PHP_EOL;
use... | y string $message;
public function __construct(string $message)
{
$this->message = $message;
}
public function notify(ExecutionFinished $event): void
{
print __METHOD__ . PHP_EOL;
print $this->message . PHP_EOL | rivate readonl | {
"filepath": "tests/end-to-end/extension-cli/_files/duplicate-extension/src/MyExecutionFinishedSubscriber.php",
"language": "php",
"file_size": 797,
"cut_index": 517,
"middle_length": 14
} |
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\Event\MyExtension;
use PHPUnit\Runner\Ext... | n
{
public function bootstrap(Configuration $configuration, Facade $facade, ParameterCollection $parameters): void
{
$facade->registerSubscriber(
new MyExecutionFinishedSubscriber(
'the-message',
),
| ments Extensio | {
"filepath": "tests/end-to-end/extension-cli/_files/duplicate-extension/src/MyExtensionBootstrap.php",
"language": "php",
"file_size": 805,
"cut_index": 517,
"middle_length": 14
} |
that was distributed with this source code.
*/
namespace PHPUnit\Util;
use const DIRECTORY_SEPARATOR;
use const PHP_EOL;
use function str_repeat;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Small;
use PHPUnit\Framework\Attributes\TestD... | => ['fg-blue', 'string', "\x1b[34mstring\x1b[0m"],
'multiple colors' => ['bold,dim,fg-blue,bg-yellow', 'string', "\x1b[1;2;34;43mstring\x1b[0m"],
'invalid color' => ['fg-invalid', 'some text', 'some text'], | rray<string, array{string, string, string}>
*/
public static function colorizeProvider(): array
{
return [
'no color' => ['', 'string', 'string'],
'one color' | {
"filepath": "tests/unit/Util/ColorTest.php",
"language": "php",
"file_size": 7924,
"cut_index": 716,
"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\Util;
use function realpath;
use PHPUnit\Framework\Attributes\CoversClass... | >assertContains(
realpath(__DIR__ . '/../../../src'),
$excludeList->getExcludedDirectories(),
);
}
public function testExclusionOfFileCanBeQueried(): void
{
$excludeList = new ExcludeList(true);
| dDirectoryException::class)]
#[Small]
#[RunTestsInSeparateProcesses]
final class ExcludeListTest extends TestCase
{
public function testIsInitialized(): void
{
$excludeList = new ExcludeList(true);
$this- | {
"filepath": "tests/unit/Util/ExcludeListTest.php",
"language": "php",
"file_size": 1936,
"cut_index": 537,
"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\Util;
use const DIRECTORY_SEPARATOR;
use PHPUnit\Fr... | eamOrFile('socket://hostname:port'));
$this->assertSame(__FILE__, Filesystem::resolveStreamOrFile(__FILE__));
$this->assertSame(__DIR__ . DIRECTORY_SEPARATOR . 'does-not-exist', Filesystem::resolveStreamOrFile(__DIR__ . '/does-not-exist')); | {
public function testCanResolveStreamOrFile(): void
{
$this->assertSame('php://stdout', Filesystem::resolveStreamOrFile('php://stdout'));
$this->assertSame('socket://hostname:port', Filesystem::resolveStr | {
"filepath": "tests/unit/Util/FilesystemTest.php",
"language": "php",
"file_size": 1114,
"cut_index": 515,
"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\Util;
use Exception;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes... | >assertSame(Filter::stackTraceFromThrowableAsString($second), Filter::stackTraceFromThrowableAsString($first));
}
public function testStackTraceFromPhptAssertionFailedError(): void
{
$e = new PhptAssertionFailedError(
'phpt | ss FilterTest extends TestCase
{
public function testUnwrapThrowableUsesPreviousValues(): void
{
$first = new Exception('first', 123, null);
$second = new Exception('second', 345, $first);
$this- | {
"filepath": "tests/unit/Util/FilterTest.php",
"language": "php",
"file_size": 2194,
"cut_index": 563,
"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\Util;
use function sprintf;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Small;
use PHPUnit\Framework\TestCase;
#[C... | 5c7://' . $dir . '/TestClassTest.php',
'file://' . $dir . '/XmlTest.php',
];
$this->assertEquals(
"require_once '" . $dir . "/GlobalStateTest.php';\n" .
"require_once 'file://" . $dir . "/XmlTest.php';\n | ): void
{
$dir = __DIR__;
$files = [
'phpunit', // The 0 index is not used
$dir . '/GlobalStateTest.php',
'vfs://' . $dir . '/RegexTest.php',
'phpvfs53e4626046 | {
"filepath": "tests/unit/Util/GlobalStateTest.php",
"language": "php",
"file_size": 3426,
"cut_index": 614,
"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\Util;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
... | alse],
['{"name":"John","age":"35","kids":[{"name":"Petr","age":"5"}]}', '{"age":"35","kids":[{"age":"5","name":"Petr"}],"name":"John"}', false],
['"name":"John","age":"35"}', '{"age":"35","name":"John"}', true],
];
}
| /**
* @return non-empty-list<array{string, string, bool}>
*/
public static function canonicalizeProvider(): array
{
return [
['{"name":"John","age":"35"}', '{"age":"35","name":"John"}', f | {
"filepath": "tests/unit/Util/JsonTest.php",
"language": "php",
"file_size": 2584,
"cut_index": 563,
"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\Util;
use function realpath;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\At... | => realpath(__DIR__ . '/../../_files/BankAccountTest.php'),
'line' => 22,
],
Reflection::sourceLocationFor(BankAccountTest::class, 'testBalanceIsInitiallyZero'),
);
}
public function testFindsSourceL | nClass;
#[CoversClass(Reflection::class)]
#[Small]
final class ReflectionTest extends TestCase
{
public function testFindsSourceLocationForMethod(): void
{
$this->assertSame(
[
'file' | {
"filepath": "tests/unit/Util/ReflectionTest.php",
"language": "php",
"file_size": 2715,
"cut_index": 563,
"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\Util;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
... | 'U+202B RIGHT-TO-LEFT EMBEDDING' => ["a\u{202B}b", 'a\u{202B}b'],
'U+202C POP DIRECTIONAL FORMATTING' => ["a\u{202C}b", 'a\u{202C}b'],
'U+202D LEFT-TO-RIGHT OVERRIDE' => ["a\u{202D}b", 'a\u | -list<array{0: string, 1: string}>
*/
public static function bidirectionalControlCharacterProvider(): array
{
return [
'U+202A LEFT-TO-RIGHT EMBEDDING' => ["a\u{202A}b", 'a\u{202A}b'],
| {
"filepath": "tests/unit/Util/SanitizerTest.php",
"language": "php",
"file_size": 2353,
"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\Util;
use PHPUnit\Framework\Attributes\CoversClass;
us... | w ReflectionMethod(TestCaseTest::class, 'testOne')],
[true, new ReflectionMethod(TestCaseTest::class, 'two')],
[false, new ReflectionMethod(TestCaseTest::class, 'three')],
[false, new ReflectionMethod(TestCaseTest::class | Test::class)]
#[Small]
final class TestTest extends TestCase
{
/**
* @return non-empty-list<array{bool, ReflectionMethod}>
*/
public static function provider(): array
{
return [
[true, ne | {
"filepath": "tests/unit/Util/TestTest.php",
"language": "php",
"file_size": 1233,
"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\Util;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Small;
use PHP... | Case
{
#[TestDox('Maps ExpectationFailedException with ComparisonFailure')]
public function testMapsExpectationFailedExceptionWithComparisonFailure(): void
{
$comparisonFailure = new ComparisonFailure('expected', 'actual', 'expected', ' | eption;
use RuntimeException;
use SebastianBergmann\Comparator\ComparisonFailure;
#[CoversClass(ThrowableToStringMapper::class)]
#[Small]
#[TestDox('ThrowableToStringMapper')]
final class ThrowableToStringMapperTest extends Test | {
"filepath": "tests/unit/Util/ThrowableToStringMapperTest.php",
"language": "php",
"file_size": 2364,
"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\Util;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework... | es(): array
{
return [
['<'],
['lt'],
['<='],
['le'],
['>'],
['gt'],
['>='],
['ge'],
['=='],
['='],
['eq'],
| CoversClass(InvalidVersionOperatorException::class)]
#[Small]
final class VersionComparisonOperatorTest extends TestCase
{
/**
* @return non-empty-list<non-empty-list<string>>
*/
public static function validValu | {
"filepath": "tests/unit/Util/VersionComparisonOperatorTest.php",
"language": "php",
"file_size": 1549,
"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\Util;
use function chr;
use function ord;
use function sprintf;
use DOMDo... | charProvider(): array
{
$data = [];
for ($i = 0; $i < 256; $i++) {
$data[] = [chr($i)];
}
return $data;
}
#[DataProvider('charProvider')]
public function testPrepareString(string $char): void
| XmlConfiguration\ValidationResult;
#[CoversClass(Xml::class)]
#[CoversClass(ValidationResult::class)]
#[Small]
final class XmlTest extends TestCase
{
/**
* @return list<array{string}>
*/
public static function | {
"filepath": "tests/unit/Util/XmlTest.php",
"language": "php",
"file_size": 1601,
"cut_index": 537,
"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\Util\Xml;
use DOMDocument;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Small;
use PHPUnit\Framework\TestCase;
#[Co... | ass);
$this->expectExceptionMessageIs('Could not read XML from file "/does/not/exist.xml"');
(new Loader)->loadFile('/does/not/exist.xml');
}
public function testCannotParseEmptyFile(): void
{
$this->expectException(Xm | '/../../../_files/configuration.xml');
$this->assertInstanceOf(DOMDocument::class, $document);
}
public function testCannotParseFileThatDoesNotExist(): void
{
$this->expectException(XmlException::cl | {
"filepath": "tests/unit/Util/Xml/LoaderTest.php",
"language": "php",
"file_size": 3237,
"cut_index": 614,
"middle_length": 229
} |
that was distributed with this source code.
*/
namespace PHPUnit\Util\PHP;
use Generator;
use PHPUnit\Event\Emitter;
use PHPUnit\Event\Facade;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Small;
use PHPUnit\Framework\Attributes\UsesClas... | new Result('test', ''),
new Job(
<<<'EOT'
<?php declare(strict_types=1);
fwrite(STDOUT, 'test');
EOT
),
];
yield 'output to stderr' => [
new Result('', 'test'),
new Job(
| JobRunner::class)]
#[UsesClass(Job::class)]
#[UsesClass(Result::class)]
#[Small]
final class JobRunnerTest extends TestCase
{
public static function provider(): Generator
{
yield 'output to stdout' => [
| {
"filepath": "tests/unit/Util/PHP/JobRunnerTest.php",
"language": "php",
"file_size": 5663,
"cut_index": 716,
"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\Util\PHP;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Small;
use PHPUnit\Framework\TestCase;
#[CoversClass(Job::cl... | ));
$this->assertFalse($job->redirectErrors());
}
public function testMayHavePhpSettings(): void
{
$phpSettings = ['foo' => 'bar'];
$job = new Job(
'the-code',
$phpSettings,
[],
| [],
[],
null,
false,
);
$this->assertSame($code, $job->code());
$this->assertFalse($job->hasEnvironmentVariables());
$this->assertFalse($job->hasInput( | {
"filepath": "tests/unit/Util/PHP/JobTest.php",
"language": "php",
"file_size": 3477,
"cut_index": 614,
"middle_length": 229
} |
clare(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\Util\PHP;
use PHPUnit\Framework\Attributes\CoversClass;
... | t', $this->fixture()->stdout());
}
public function testHasOutputFromStderr(): void
{
$this->assertSame('stderr', $this->fixture()->stderr());
}
private function fixture(): Result
{
return new Result('stdout', 'stde | tdout(): void
{
$this->assertSame('stdou | {
"filepath": "tests/unit/Util/PHP/ResultTest.php",
"language": "php",
"file_size": 842,
"cut_index": 520,
"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\Issue5884;
use const E_USER_DEPRECATED;
use function chmod;
use function file_get_conte... | {
$this->expectUserDeprecationMessage('foo');
trigger_error('foo', E_USER_DEPRECATED);
}
#[IgnoreDeprecations]
public function testExpectUserDeprecationMessageANDIgnoringDeprecations(): void
{
$this->expectUserDepr | eDeprecations;
use PHPUnit\Framework\Attributes\WithoutErrorHandler;
use PHPUnit\Framework\TestCase;
final class FooTest extends TestCase
{
public function testExpectUserDeprecationMessageNOTIgnoringDeprecations(): void
| {
"filepath": "tests/end-to-end/regression/5884/tests/FooTest.php",
"language": "php",
"file_size": 2987,
"cut_index": 563,
"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 function restore_error_handler;
use function restore_exception_handler;
use functi... | previous);
$this->assertTrue(true);
}
public function testAddedErrorHandler(): void
{
$previous = set_error_handler($this->addedErrorHandler(...));
$this->assertInstanceOf(ErrorHandler::class, $previous);
$this | ublic function testAddedAndRemovedErrorHandler(): void
{
$previous = set_error_handler($this->addedAndRemovedErrorHandler(...));
restore_error_handler();
$this->assertInstanceOf(ErrorHandler::class, $ | {
"filepath": "tests/end-to-end/regression/5592/Issue5592TestIsolation.php",
"language": "php",
"file_size": 2259,
"cut_index": 563,
"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 PHPUnit\Framework\Attributes\PreserveGlobalState;
use PHPUnit\Framework\Attributes... | tion testGlobalIntFalsey(): void
{
$this->assertEquals(0, $GLOBALS['globalIntFalsey']);
}
public function testGlobalFloat(): void
{
$this->assertEquals(1.123, $GLOBALS['globalFloat']);
}
public function testGlobalB | String(): void
{
$this->assertEquals('Hello', $GLOBALS['globalString']);
}
public function testGlobalIntTruthy(): void
{
$this->assertEquals(1, $GLOBALS['globalIntTruthy']);
}
public func | {
"filepath": "tests/end-to-end/regression/1335/Issue1335Test.php",
"language": "php",
"file_size": 2146,
"cut_index": 563,
"middle_length": 229
} |
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;
use PHPUnit\Framework\Attributes\DataProvider;
use P... | tDependencies(): void
{
$this->assertTrue(true);
}
#[Depends('testFirstWithoutDependencies')]
#[DataProvider('someDataProvider')]
public function testSecondThatDependsOnFirstAndDataprovider($value): void
{
$this->as | alues']];
}
public function testFirstWithou | {
"filepath": "tests/end-to-end/regression/3093/Issue3093Test.php",
"language": "php",
"file_size": 861,
"cut_index": 529,
"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\Issue5875;
use PHPUnit\Framework\Attrib... | econdTest(): void
{
$this->assertSame(1, self::$destructsDone);
}
#[Depends('testSecondTest')]
#[TestWith([2])]
#[TestWith([3])]
#[TestWith([4])]
public function testThirdTestWhichUsesDataProvider($numberOfTestsBeforeTh | nction __destruct()
{
self::$destructsDone++;
}
public function testFirstTest(): void
{
$this->assertSame(0, self::$destructsDone);
}
#[Depends('testFirstTest')]
public function testS | {
"filepath": "tests/end-to-end/regression/5875/Issue5875Test.php",
"language": "php",
"file_size": 1105,
"cut_index": 515,
"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;
... | edException
* @throws InvalidArgumentException
*/
#[DataProvider('provideBrandService')]
public function testBrandService($provided, $expected): void
{
$this->assertSame($provided, $expected);
}
/**
* @throws \Ex | stCase
{
public static function provideBrandService()
{
return [
// [true, true]
new stdClass, // not valid
];
}
/**
* @throws Exception
* @throws ExpectationFail | {
"filepath": "tests/end-to-end/regression/2137/Issue2137Test.php",
"language": "php",
"file_size": 1286,
"cut_index": 524,
"middle_length": 229
} |
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\DiffContext;
use PHPUnit\Framework\TestCase;
final c... | 7\nline18\nline19\nline20";
$actual = "line01\nline02\nline03\nline04\nline05\nline06\nline07\nline08\nline09\nLINE10\nline11\nline12\nline13\nline14\nline15\nline16\nline17\nline18\nline19\nline20";
$this->assertStringMatchesFormat($forma | ine11\nline12\nline13\nline14\nline15\nline16\nline1 | {
"filepath": "tests/end-to-end/cli/diff-context/_files/DiffContextTest.php",
"language": "php",
"file_size": 858,
"cut_index": 529,
"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\A... | yield ['Dollar sign followed by letter $Q'];
yield ['Alone $ surrounded by spaces'];
}
#[DataProvider('dataProvider')]
#[TestDox('The "$x" is used for this test')]
public function testSomething(string $x): void
{
| yield ['Some text before the price $5.67'];
| {
"filepath": "tests/end-to-end/logging/_files/CaseWithDollarSignTest.php",
"language": "php",
"file_size": 891,
"cut_index": 547,
"middle_length": 52
} |
are(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\RegisterSubscribers;
use PHPUnit\Runner\... | sion
{
public function bootstrap(Configuration $configuration, Facade $facade, ParameterCollection $parameters): void
{
$facade->registerSubscribers(
new MyExecutionStartedSubscriber,
new MyExecutionFinishedSubscribe | plements Exten | {
"filepath": "tests/end-to-end/extension-xml/_files/extension-register-subscribers/src/MyExtensionBootstrap.php",
"language": "php",
"file_size": 814,
"cut_index": 522,
"middle_length": 14
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.