Skip to content

Commit 51c0bf0

Browse files
phpfourfabpot
authored andcommitted
[PhpUnitBridge] Polyfill new phpunit 9.1 assertions
1 parent ef19a03 commit 51c0bf0

File tree

2 files changed

+118
-1
lines changed

2 files changed

+118
-1
lines changed

src/Symfony/Bridge/PhpUnit/CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
5.2.0
5+
-----
6+
7+
* polyfill new phpunit 9.1 assertions
8+
49
5.1.0
510
-----
611

@@ -25,7 +30,7 @@ CHANGELOG
2530
-----
2631

2732
* added `ClassExistsMock`
28-
* bumped PHP version from 5.3.3 to 5.5.9
33+
* bumped PHP version from 5.3.3 to 5.5.9
2934
* split simple-phpunit bin into php file with code and a shell script
3035

3136
4.1.0

src/Symfony/Bridge/PhpUnit/Legacy/PolyfillAssertTrait.php

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,17 @@ public static function assertNotIsReadable($filename, $message = '')
276276
static::assertFalse(is_readable($filename), $message ? $message : "Failed asserting that $filename is not readable.");
277277
}
278278

279+
/**
280+
* @param string $filename
281+
* @param string $message
282+
*
283+
* @return void
284+
*/
285+
public static function assertIsNotReadable($filename, $message = '')
286+
{
287+
static::assertNotIsReadable($filename, $message);
288+
}
289+
279290
/**
280291
* @param string $filename
281292
* @param string $message
@@ -300,6 +311,17 @@ public static function assertNotIsWritable($filename, $message = '')
300311
static::assertFalse(is_writable($filename), $message ? $message : "Failed asserting that $filename is not writable.");
301312
}
302313

314+
/**
315+
* @param string $filename
316+
* @param string $message
317+
*
318+
* @return void
319+
*/
320+
public static function assertIsNotWritable($filename, $message = '')
321+
{
322+
static::assertNotIsWritable($filename, $message);
323+
}
324+
303325
/**
304326
* @param string $directory
305327
* @param string $message
@@ -324,6 +346,17 @@ public static function assertDirectoryNotExists($directory, $message = '')
324346
static::assertFalse(is_dir($directory), $message ? $message : "Failed asserting that $directory does not exist.");
325347
}
326348

349+
/**
350+
* @param string $directory
351+
* @param string $message
352+
*
353+
* @return void
354+
*/
355+
public static function assertDirectoryDoesNotExist($directory, $message = '')
356+
{
357+
static::assertDirectoryNotExists($directory, $message);
358+
}
359+
327360
/**
328361
* @param string $directory
329362
* @param string $message
@@ -348,6 +381,17 @@ public static function assertDirectoryNotIsReadable($directory, $message = '')
348381
static::assertNotIsReadable($directory, $message);
349382
}
350383

384+
/**
385+
* @param string $directory
386+
* @param string $message
387+
*
388+
* @return void
389+
*/
390+
public static function assertDirectoryIsNotReadable($directory, $message = '')
391+
{
392+
static::assertDirectoryNotIsReadable($directory, $message);
393+
}
394+
351395
/**
352396
* @param string $directory
353397
* @param string $message
@@ -372,6 +416,17 @@ public static function assertDirectoryNotIsWritable($directory, $message = '')
372416
static::assertNotIsWritable($directory, $message);
373417
}
374418

419+
/**
420+
* @param string $directory
421+
* @param string $message
422+
*
423+
* @return void
424+
*/
425+
public static function assertDirectoryIsNotWritable($directory, $message = '')
426+
{
427+
static::assertDirectoryNotIsWritable($directory, $message);
428+
}
429+
375430
/**
376431
* @param string $filename
377432
* @param string $message
@@ -396,6 +451,17 @@ public static function assertFileNotExists($filename, $message = '')
396451
static::assertFalse(file_exists($filename), $message ? $message : "Failed asserting that $filename does not exist.");
397452
}
398453

454+
/**
455+
* @param string $filename
456+
* @param string $message
457+
*
458+
* @return void
459+
*/
460+
public static function assertFileDoesNotExist($filename, $message = '')
461+
{
462+
static::assertFileNotExists($filename, $message);
463+
}
464+
399465
/**
400466
* @param string $filename
401467
* @param string $message
@@ -420,6 +486,17 @@ public static function assertFileNotIsReadable($filename, $message = '')
420486
static::assertNotIsReadable($filename, $message);
421487
}
422488

489+
/**
490+
* @param string $filename
491+
* @param string $message
492+
*
493+
* @return void
494+
*/
495+
public static function assertFileIsNotReadable($filename, $message = '')
496+
{
497+
static::assertFileNotIsReadable($filename, $message);
498+
}
499+
423500
/**
424501
* @param string $filename
425502
* @param string $message
@@ -443,4 +520,39 @@ public static function assertFileNotIsWritable($filename, $message = '')
443520
static::assertFileExists($filename, $message);
444521
static::assertNotIsWritable($filename, $message);
445522
}
523+
524+
/**
525+
* @param string $filename
526+
* @param string $message
527+
*
528+
* @return void
529+
*/
530+
public static function assertFileIsNotWritable($filename, $message = '')
531+
{
532+
static::assertFileNotIsWritable($filename, $message);
533+
}
534+
535+
/**
536+
* @param string $pattern
537+
* @param string $string
538+
* @param string $message
539+
*
540+
* @return void
541+
*/
542+
public static function assertMatchesRegularExpression($pattern, $string, $message = '')
543+
{
544+
static::assertRegExp($pattern, $string, $message);
545+
}
546+
547+
/**
548+
* @param string $pattern
549+
* @param string $string
550+
* @param string $message
551+
*
552+
* @return void
553+
*/
554+
public static function assertDoesNotMatchRegularExpression($pattern, $string, $message = '')
555+
{
556+
static::assertNotRegExp($message, $string, $message);
557+
}
446558
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy