| Zeile 35... |
Zeile 35... |
| 35 |
use ArrayAccess;
|
35 |
use ArrayAccess;
|
| 36 |
use Countable;
|
36 |
use Countable;
|
| 37 |
use DOMAttr;
|
37 |
use DOMAttr;
|
| 38 |
use DOMDocument;
|
38 |
use DOMDocument;
|
| 39 |
use DOMElement;
|
39 |
use DOMElement;
|
| - |
|
40 |
use Generator;
|
| 40 |
use PHPUnit\Framework\Constraint\ArrayHasKey;
|
41 |
use PHPUnit\Framework\Constraint\ArrayHasKey;
|
| 41 |
use PHPUnit\Framework\Constraint\Callback;
|
42 |
use PHPUnit\Framework\Constraint\Callback;
|
| 42 |
use PHPUnit\Framework\Constraint\ClassHasAttribute;
|
43 |
use PHPUnit\Framework\Constraint\ClassHasAttribute;
|
| 43 |
use PHPUnit\Framework\Constraint\ClassHasStaticAttribute;
|
44 |
use PHPUnit\Framework\Constraint\ClassHasStaticAttribute;
|
| 44 |
use PHPUnit\Framework\Constraint\Constraint;
|
45 |
use PHPUnit\Framework\Constraint\Constraint;
|
| Zeile 276... |
Zeile 277... |
| 276 |
* @throws Exception
|
277 |
* @throws Exception
|
| 277 |
* @throws ExpectationFailedException
|
278 |
* @throws ExpectationFailedException
|
| 278 |
*/
|
279 |
*/
|
| 279 |
public static function assertCount(int $expectedCount, $haystack, string $message = ''): void
|
280 |
public static function assertCount(int $expectedCount, $haystack, string $message = ''): void
|
| 280 |
{
|
281 |
{
|
| - |
|
282 |
if ($haystack instanceof Generator) {
|
| - |
|
283 |
self::createWarning('Passing an argument of type Generator for the $haystack parameter is deprecated. Support for this will be removed in PHPUnit 10.');
|
| - |
|
284 |
}
|
| - |
|
285 |
|
| 281 |
if (!$haystack instanceof Countable && !is_iterable($haystack)) {
|
286 |
if (!$haystack instanceof Countable && !is_iterable($haystack)) {
|
| 282 |
throw InvalidArgumentException::create(2, 'countable or iterable');
|
287 |
throw InvalidArgumentException::create(2, 'countable or iterable');
|
| 283 |
}
|
288 |
}
|
| Zeile 284... |
Zeile 289... |
| 284 |
|
289 |
|
| Zeile 298... |
Zeile 303... |
| 298 |
* @throws Exception
|
303 |
* @throws Exception
|
| 299 |
* @throws ExpectationFailedException
|
304 |
* @throws ExpectationFailedException
|
| 300 |
*/
|
305 |
*/
|
| 301 |
public static function assertNotCount(int $expectedCount, $haystack, string $message = ''): void
|
306 |
public static function assertNotCount(int $expectedCount, $haystack, string $message = ''): void
|
| 302 |
{
|
307 |
{
|
| - |
|
308 |
if ($haystack instanceof Generator) {
|
| - |
|
309 |
self::createWarning('Passing an argument of type Generator for the $haystack parameter is deprecated. Support for this will be removed in PHPUnit 10.');
|
| - |
|
310 |
}
|
| - |
|
311 |
|
| 303 |
if (!$haystack instanceof Countable && !is_iterable($haystack)) {
|
312 |
if (!$haystack instanceof Countable && !is_iterable($haystack)) {
|
| 304 |
throw InvalidArgumentException::create(2, 'countable or iterable');
|
313 |
throw InvalidArgumentException::create(2, 'countable or iterable');
|
| 305 |
}
|
314 |
}
|
| Zeile 306... |
Zeile 315... |
| 306 |
|
315 |
|
| Zeile 449... |
Zeile 458... |
| 449 |
*
|
458 |
*
|
| 450 |
* @psalm-assert empty $actual
|
459 |
* @psalm-assert empty $actual
|
| 451 |
*/
|
460 |
*/
|
| 452 |
public static function assertEmpty($actual, string $message = ''): void
|
461 |
public static function assertEmpty($actual, string $message = ''): void
|
| 453 |
{
|
462 |
{
|
| - |
|
463 |
if ($actual instanceof Generator) {
|
| - |
|
464 |
self::createWarning('Passing an argument of type Generator for the $actual parameter is deprecated. Support for this will be removed in PHPUnit 10.');
|
| - |
|
465 |
}
|
| - |
|
466 |
|
| 454 |
static::assertThat($actual, static::isEmpty(), $message);
|
467 |
static::assertThat($actual, static::isEmpty(), $message);
|
| 455 |
}
|
468 |
}
|
| Zeile 456... |
Zeile 469... |
| 456 |
|
469 |
|
| 457 |
/**
|
470 |
/**
|
| Zeile 462... |
Zeile 475... |
| 462 |
*
|
475 |
*
|
| 463 |
* @psalm-assert !empty $actual
|
476 |
* @psalm-assert !empty $actual
|
| 464 |
*/
|
477 |
*/
|
| 465 |
public static function assertNotEmpty($actual, string $message = ''): void
|
478 |
public static function assertNotEmpty($actual, string $message = ''): void
|
| 466 |
{
|
479 |
{
|
| - |
|
480 |
if ($actual instanceof Generator) {
|
| - |
|
481 |
self::createWarning('Passing an argument of type Generator for the $actual parameter is deprecated. Support for this will be removed in PHPUnit 10.');
|
| - |
|
482 |
}
|
| - |
|
483 |
|
| 467 |
static::assertThat($actual, static::logicalNot(static::isEmpty()), $message);
|
484 |
static::assertThat($actual, static::logicalNot(static::isEmpty()), $message);
|
| 468 |
}
|
485 |
}
|
| Zeile 469... |
Zeile 486... |
| 469 |
|
486 |
|
| 470 |
/**
|
487 |
/**
|
| Zeile 1166... |
Zeile 1183... |
| 1166 |
* Asserts that a class has a specified attribute.
|
1183 |
* Asserts that a class has a specified attribute.
|
| 1167 |
*
|
1184 |
*
|
| 1168 |
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
1185 |
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
| 1169 |
* @throws Exception
|
1186 |
* @throws Exception
|
| 1170 |
* @throws ExpectationFailedException
|
1187 |
* @throws ExpectationFailedException
|
| - |
|
1188 |
*
|
| - |
|
1189 |
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
|
| 1171 |
*/
|
1190 |
*/
|
| 1172 |
public static function assertClassHasAttribute(string $attributeName, string $className, string $message = ''): void
|
1191 |
public static function assertClassHasAttribute(string $attributeName, string $className, string $message = ''): void
|
| 1173 |
{
|
1192 |
{
|
| - |
|
1193 |
self::createWarning('assertClassHasAttribute() is deprecated and will be removed in PHPUnit 10.');
|
| - |
|
1194 |
|
| 1174 |
if (!self::isValidClassAttributeName($attributeName)) {
|
1195 |
if (!self::isValidClassAttributeName($attributeName)) {
|
| 1175 |
throw InvalidArgumentException::create(1, 'valid attribute name');
|
1196 |
throw InvalidArgumentException::create(1, 'valid attribute name');
|
| 1176 |
}
|
1197 |
}
|
| Zeile 1177... |
Zeile 1198... |
| 1177 |
|
1198 |
|
| Zeile 1186... |
Zeile 1207... |
| 1186 |
* Asserts that a class does not have a specified attribute.
|
1207 |
* Asserts that a class does not have a specified attribute.
|
| 1187 |
*
|
1208 |
*
|
| 1188 |
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
1209 |
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
| 1189 |
* @throws Exception
|
1210 |
* @throws Exception
|
| 1190 |
* @throws ExpectationFailedException
|
1211 |
* @throws ExpectationFailedException
|
| - |
|
1212 |
*
|
| - |
|
1213 |
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
|
| 1191 |
*/
|
1214 |
*/
|
| 1192 |
public static function assertClassNotHasAttribute(string $attributeName, string $className, string $message = ''): void
|
1215 |
public static function assertClassNotHasAttribute(string $attributeName, string $className, string $message = ''): void
|
| 1193 |
{
|
1216 |
{
|
| - |
|
1217 |
self::createWarning('assertClassNotHasAttribute() is deprecated and will be removed in PHPUnit 10.');
|
| - |
|
1218 |
|
| 1194 |
if (!self::isValidClassAttributeName($attributeName)) {
|
1219 |
if (!self::isValidClassAttributeName($attributeName)) {
|
| 1195 |
throw InvalidArgumentException::create(1, 'valid attribute name');
|
1220 |
throw InvalidArgumentException::create(1, 'valid attribute name');
|
| 1196 |
}
|
1221 |
}
|
| Zeile 1197... |
Zeile 1222... |
| 1197 |
|
1222 |
|
| Zeile 1212... |
Zeile 1237... |
| 1212 |
* Asserts that a class has a specified static attribute.
|
1237 |
* Asserts that a class has a specified static attribute.
|
| 1213 |
*
|
1238 |
*
|
| 1214 |
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
1239 |
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
| 1215 |
* @throws Exception
|
1240 |
* @throws Exception
|
| 1216 |
* @throws ExpectationFailedException
|
1241 |
* @throws ExpectationFailedException
|
| - |
|
1242 |
*
|
| - |
|
1243 |
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
|
| 1217 |
*/
|
1244 |
*/
|
| 1218 |
public static function assertClassHasStaticAttribute(string $attributeName, string $className, string $message = ''): void
|
1245 |
public static function assertClassHasStaticAttribute(string $attributeName, string $className, string $message = ''): void
|
| 1219 |
{
|
1246 |
{
|
| - |
|
1247 |
self::createWarning('assertClassHasStaticAttribute() is deprecated and will be removed in PHPUnit 10.');
|
| - |
|
1248 |
|
| 1220 |
if (!self::isValidClassAttributeName($attributeName)) {
|
1249 |
if (!self::isValidClassAttributeName($attributeName)) {
|
| 1221 |
throw InvalidArgumentException::create(1, 'valid attribute name');
|
1250 |
throw InvalidArgumentException::create(1, 'valid attribute name');
|
| 1222 |
}
|
1251 |
}
|
| Zeile 1223... |
Zeile 1252... |
| 1223 |
|
1252 |
|
| Zeile 1236... |
Zeile 1265... |
| 1236 |
* Asserts that a class does not have a specified static attribute.
|
1265 |
* Asserts that a class does not have a specified static attribute.
|
| 1237 |
*
|
1266 |
*
|
| 1238 |
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
1267 |
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
| 1239 |
* @throws Exception
|
1268 |
* @throws Exception
|
| 1240 |
* @throws ExpectationFailedException
|
1269 |
* @throws ExpectationFailedException
|
| - |
|
1270 |
*
|
| - |
|
1271 |
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
|
| 1241 |
*/
|
1272 |
*/
|
| 1242 |
public static function assertClassNotHasStaticAttribute(string $attributeName, string $className, string $message = ''): void
|
1273 |
public static function assertClassNotHasStaticAttribute(string $attributeName, string $className, string $message = ''): void
|
| 1243 |
{
|
1274 |
{
|
| - |
|
1275 |
self::createWarning('assertClassNotHasStaticAttribute() is deprecated and will be removed in PHPUnit 10.');
|
| - |
|
1276 |
|
| 1244 |
if (!self::isValidClassAttributeName($attributeName)) {
|
1277 |
if (!self::isValidClassAttributeName($attributeName)) {
|
| 1245 |
throw InvalidArgumentException::create(1, 'valid attribute name');
|
1278 |
throw InvalidArgumentException::create(1, 'valid attribute name');
|
| 1246 |
}
|
1279 |
}
|
| Zeile 1247... |
Zeile 1280... |
| 1247 |
|
1280 |
|
| Zeile 1264... |
Zeile 1297... |
| 1264 |
* @param object $object
|
1297 |
* @param object $object
|
| 1265 |
*
|
1298 |
*
|
| 1266 |
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
1299 |
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
| 1267 |
* @throws Exception
|
1300 |
* @throws Exception
|
| 1268 |
* @throws ExpectationFailedException
|
1301 |
* @throws ExpectationFailedException
|
| - |
|
1302 |
*
|
| - |
|
1303 |
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
|
| 1269 |
*/
|
1304 |
*/
|
| 1270 |
public static function assertObjectHasAttribute(string $attributeName, $object, string $message = ''): void
|
1305 |
public static function assertObjectHasAttribute(string $attributeName, $object, string $message = ''): void
|
| 1271 |
{
|
1306 |
{
|
| - |
|
1307 |
self::createWarning('assertObjectHasAttribute() is deprecated and will be removed in PHPUnit 10.');
|
| - |
|
1308 |
|
| 1272 |
if (!self::isValidObjectAttributeName($attributeName)) {
|
1309 |
if (!self::isValidObjectAttributeName($attributeName)) {
|
| 1273 |
throw InvalidArgumentException::create(1, 'valid attribute name');
|
1310 |
throw InvalidArgumentException::create(1, 'valid attribute name');
|
| 1274 |
}
|
1311 |
}
|
| Zeile 1275... |
Zeile 1312... |
| 1275 |
|
1312 |
|
| Zeile 1290... |
Zeile 1327... |
| 1290 |
* @param object $object
|
1327 |
* @param object $object
|
| 1291 |
*
|
1328 |
*
|
| 1292 |
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
1329 |
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
| 1293 |
* @throws Exception
|
1330 |
* @throws Exception
|
| 1294 |
* @throws ExpectationFailedException
|
1331 |
* @throws ExpectationFailedException
|
| - |
|
1332 |
*
|
| - |
|
1333 |
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
|
| 1295 |
*/
|
1334 |
*/
|
| 1296 |
public static function assertObjectNotHasAttribute(string $attributeName, $object, string $message = ''): void
|
1335 |
public static function assertObjectNotHasAttribute(string $attributeName, $object, string $message = ''): void
|
| 1297 |
{
|
1336 |
{
|
| - |
|
1337 |
self::createWarning('assertObjectNotHasAttribute() is deprecated and will be removed in PHPUnit 10.');
|
| - |
|
1338 |
|
| 1298 |
if (!self::isValidObjectAttributeName($attributeName)) {
|
1339 |
if (!self::isValidObjectAttributeName($attributeName)) {
|
| 1299 |
throw InvalidArgumentException::create(1, 'valid attribute name');
|
1340 |
throw InvalidArgumentException::create(1, 'valid attribute name');
|
| 1300 |
}
|
1341 |
}
|
| Zeile 1301... |
Zeile 1342... |
| 1301 |
|
1342 |
|
| Zeile 1899... |
Zeile 1940... |
| 1899 |
* @throws Exception
|
1940 |
* @throws Exception
|
| 1900 |
* @throws ExpectationFailedException
|
1941 |
* @throws ExpectationFailedException
|
| 1901 |
*/
|
1942 |
*/
|
| 1902 |
public static function assertSameSize($expected, $actual, string $message = ''): void
|
1943 |
public static function assertSameSize($expected, $actual, string $message = ''): void
|
| 1903 |
{
|
1944 |
{
|
| - |
|
1945 |
if ($expected instanceof Generator) {
|
| - |
|
1946 |
self::createWarning('Passing an argument of type Generator for the $expected parameter is deprecated. Support for this will be removed in PHPUnit 10.');
|
| - |
|
1947 |
}
|
| - |
|
1948 |
|
| - |
|
1949 |
if ($actual instanceof Generator) {
|
| - |
|
1950 |
self::createWarning('Passing an argument of type Generator for the $actual parameter is deprecated. Support for this will be removed in PHPUnit 10.');
|
| - |
|
1951 |
}
|
| - |
|
1952 |
|
| 1904 |
if (!$expected instanceof Countable && !is_iterable($expected)) {
|
1953 |
if (!$expected instanceof Countable && !is_iterable($expected)) {
|
| 1905 |
throw InvalidArgumentException::create(1, 'countable or iterable');
|
1954 |
throw InvalidArgumentException::create(1, 'countable or iterable');
|
| 1906 |
}
|
1955 |
}
|
| Zeile 1907... |
Zeile 1956... |
| 1907 |
|
1956 |
|
| Zeile 1927... |
Zeile 1976... |
| 1927 |
* @throws Exception
|
1976 |
* @throws Exception
|
| 1928 |
* @throws ExpectationFailedException
|
1977 |
* @throws ExpectationFailedException
|
| 1929 |
*/
|
1978 |
*/
|
| 1930 |
public static function assertNotSameSize($expected, $actual, string $message = ''): void
|
1979 |
public static function assertNotSameSize($expected, $actual, string $message = ''): void
|
| 1931 |
{
|
1980 |
{
|
| - |
|
1981 |
if ($expected instanceof Generator) {
|
| - |
|
1982 |
self::createWarning('Passing an argument of type Generator for the $expected parameter is deprecated. Support for this will be removed in PHPUnit 10.');
|
| - |
|
1983 |
}
|
| - |
|
1984 |
|
| - |
|
1985 |
if ($actual instanceof Generator) {
|
| - |
|
1986 |
self::createWarning('Passing an argument of type Generator for the $actual parameter is deprecated. Support for this will be removed in PHPUnit 10.');
|
| - |
|
1987 |
}
|
| - |
|
1988 |
|
| 1932 |
if (!$expected instanceof Countable && !is_iterable($expected)) {
|
1989 |
if (!$expected instanceof Countable && !is_iterable($expected)) {
|
| 1933 |
throw InvalidArgumentException::create(1, 'countable or iterable');
|
1990 |
throw InvalidArgumentException::create(1, 'countable or iterable');
|
| 1934 |
}
|
1991 |
}
|
| Zeile 1935... |
Zeile 1992... |
| 1935 |
|
1992 |
|
| Zeile 2666... |
Zeile 2723... |
| 2666 |
new IsEqual($value),
|
2723 |
new IsEqual($value),
|
| 2667 |
new GreaterThan($value)
|
2724 |
new GreaterThan($value)
|
| 2668 |
);
|
2725 |
);
|
| 2669 |
}
|
2726 |
}
|
| Zeile -... |
Zeile 2727... |
| - |
|
2727 |
|
| - |
|
2728 |
/**
|
| - |
|
2729 |
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
|
| 2670 |
|
2730 |
*/
|
| 2671 |
public static function classHasAttribute(string $attributeName): ClassHasAttribute
|
2731 |
public static function classHasAttribute(string $attributeName): ClassHasAttribute
|
| - |
|
2732 |
{
|
| - |
|
2733 |
self::createWarning('classHasAttribute() is deprecated and will be removed in PHPUnit 10.');
|
| 2672 |
{
|
2734 |
|
| 2673 |
return new ClassHasAttribute($attributeName);
|
2735 |
return new ClassHasAttribute($attributeName);
|
| Zeile -... |
Zeile 2736... |
| - |
|
2736 |
}
|
| - |
|
2737 |
|
| - |
|
2738 |
/**
|
| 2674 |
}
|
2739 |
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
|
| 2675 |
|
2740 |
*/
|
| - |
|
2741 |
public static function classHasStaticAttribute(string $attributeName): ClassHasStaticAttribute
|
| - |
|
2742 |
{
|
| 2676 |
public static function classHasStaticAttribute(string $attributeName): ClassHasStaticAttribute
|
2743 |
self::createWarning('classHasStaticAttribute() is deprecated and will be removed in PHPUnit 10.');
|
| 2677 |
{
|
2744 |
|
| Zeile -... |
Zeile 2745... |
| - |
|
2745 |
return new ClassHasStaticAttribute($attributeName);
|
| - |
|
2746 |
}
|
| - |
|
2747 |
|
| 2678 |
return new ClassHasStaticAttribute($attributeName);
|
2748 |
/**
|
| 2679 |
}
|
2749 |
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/4601
|
| - |
|
2750 |
*/
|
| - |
|
2751 |
public static function objectHasAttribute($attributeName): ObjectHasAttribute
|
| 2680 |
|
2752 |
{
|
| 2681 |
public static function objectHasAttribute($attributeName): ObjectHasAttribute
|
2753 |
self::createWarning('objectHasAttribute() is deprecated and will be removed in PHPUnit 10.');
|
| Zeile 2682... |
Zeile 2754... |
| 2682 |
{
|
2754 |
|
| 2683 |
return new ObjectHasAttribute($attributeName);
|
2755 |
return new ObjectHasAttribute($attributeName);
|