Merge branch '4.4' into 5.1
* 4.4: [PhpUnitBridge] Create a predictable symlink pointing to the local install [PropertyInfo] Backport support for typed properties (PHP 7.4) [PhpUnitBridge] Polyfill new phpunit 9.1 assertions [PhpUnitBridge] Move assertMatchesRegularExpression in PolyfillAssertTrait [PhpUnit] Add polyfill for assertMatchesRegularExpression()
This commit is contained in:
commit
f6c0706762
@ -25,7 +25,7 @@ CHANGELOG
|
||||
-----
|
||||
|
||||
* added `ClassExistsMock`
|
||||
* bumped PHP version from 5.3.3 to 5.5.9
|
||||
* bumped PHP version from 5.3.3 to 5.5.9
|
||||
* split simple-phpunit bin into php file with code and a shell script
|
||||
|
||||
4.1.0
|
||||
|
@ -13,6 +13,7 @@ namespace Symfony\Bridge\PhpUnit\Legacy;
|
||||
|
||||
use PHPUnit\Framework\Constraint\IsEqual;
|
||||
use PHPUnit\Framework\Constraint\LogicalNot;
|
||||
use PHPUnit\Framework\Constraint\RegularExpression;
|
||||
use PHPUnit\Framework\Constraint\StringContains;
|
||||
use PHPUnit\Framework\Constraint\TraversableContains;
|
||||
|
||||
@ -276,6 +277,17 @@ trait PolyfillAssertTrait
|
||||
static::assertFalse(is_readable($filename), $message ? $message : "Failed asserting that $filename is not readable.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $filename
|
||||
* @param string $message
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function assertIsNotReadable($filename, $message = '')
|
||||
{
|
||||
static::assertNotIsReadable($filename, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $filename
|
||||
* @param string $message
|
||||
@ -300,6 +312,17 @@ trait PolyfillAssertTrait
|
||||
static::assertFalse(is_writable($filename), $message ? $message : "Failed asserting that $filename is not writable.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $filename
|
||||
* @param string $message
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function assertIsNotWritable($filename, $message = '')
|
||||
{
|
||||
static::assertNotIsWritable($filename, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $directory
|
||||
* @param string $message
|
||||
@ -324,6 +347,17 @@ trait PolyfillAssertTrait
|
||||
static::assertFalse(is_dir($directory), $message ? $message : "Failed asserting that $directory does not exist.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $directory
|
||||
* @param string $message
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function assertDirectoryDoesNotExist($directory, $message = '')
|
||||
{
|
||||
static::assertDirectoryNotExists($directory, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $directory
|
||||
* @param string $message
|
||||
@ -348,6 +382,17 @@ trait PolyfillAssertTrait
|
||||
static::assertNotIsReadable($directory, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $directory
|
||||
* @param string $message
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function assertDirectoryIsNotReadable($directory, $message = '')
|
||||
{
|
||||
static::assertDirectoryNotIsReadable($directory, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $directory
|
||||
* @param string $message
|
||||
@ -372,6 +417,17 @@ trait PolyfillAssertTrait
|
||||
static::assertNotIsWritable($directory, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $directory
|
||||
* @param string $message
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function assertDirectoryIsNotWritable($directory, $message = '')
|
||||
{
|
||||
static::assertDirectoryNotIsWritable($directory, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $filename
|
||||
* @param string $message
|
||||
@ -396,6 +452,17 @@ trait PolyfillAssertTrait
|
||||
static::assertFalse(file_exists($filename), $message ? $message : "Failed asserting that $filename does not exist.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $filename
|
||||
* @param string $message
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function assertFileDoesNotExist($filename, $message = '')
|
||||
{
|
||||
static::assertFileNotExists($filename, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $filename
|
||||
* @param string $message
|
||||
@ -420,6 +487,17 @@ trait PolyfillAssertTrait
|
||||
static::assertNotIsReadable($filename, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $filename
|
||||
* @param string $message
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function assertFileIsNotReadable($filename, $message = '')
|
||||
{
|
||||
static::assertFileNotIsReadable($filename, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $filename
|
||||
* @param string $message
|
||||
@ -443,4 +521,39 @@ trait PolyfillAssertTrait
|
||||
static::assertFileExists($filename, $message);
|
||||
static::assertNotIsWritable($filename, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $filename
|
||||
* @param string $message
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function assertFileIsNotWritable($filename, $message = '')
|
||||
{
|
||||
static::assertFileNotIsWritable($filename, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $pattern
|
||||
* @param string $string
|
||||
* @param string $message
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function assertMatchesRegularExpression($pattern, $string, $message = '')
|
||||
{
|
||||
static::assertRegExp($pattern, $string, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $pattern
|
||||
* @param string $string
|
||||
* @param string $message
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function assertDoesNotMatchRegularExpression($pattern, $string, $message = '')
|
||||
{
|
||||
static::assertNotRegExp($message, $string, $message);
|
||||
}
|
||||
}
|
||||
|
@ -284,6 +284,16 @@ EOPHP
|
||||
chdir($oldPwd);
|
||||
}
|
||||
|
||||
// Create a symlink with a predictable path pointing to the currently used version.
|
||||
// This is useful for static analytics tools such as PHPStan having to load PHPUnit's classes
|
||||
// and for other testing libraries such as Behat using PHPUnit's assertions.
|
||||
chdir($PHPUNIT_DIR);
|
||||
if (file_exists('phpunit')) {
|
||||
@unlink('phpunit');
|
||||
}
|
||||
@symlink($PHPUNIT_VERSION_DIR, 'phpunit');
|
||||
chdir($oldPwd);
|
||||
|
||||
if ($PHPUNIT_VERSION < 8.0) {
|
||||
$argv = array_filter($argv, function ($v) use (&$argc) {
|
||||
if ('--do-not-cache-result' !== $v) {
|
||||
|
Reference in New Issue
Block a user