bug #37970 [PhpUnitBridge] Polyfill new phpunit 9.1 assertions (phpfour)
This PR was merged into the 4.4 branch.
Discussion
----------
[PhpUnitBridge] Polyfill new phpunit 9.1 assertions
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix #37320
| License | MIT
| Doc PR | -
Backport of #37567, follows the discussion on #37960.
Commits
-------
d945b88c1a
[PhpUnitBridge] Polyfill new phpunit 9.1 assertions
This commit is contained in:
commit
f4115e7717
@ -12,7 +12,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
|
||||
|
@ -277,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
|
||||
@ -301,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
|
||||
@ -325,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
|
||||
@ -349,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
|
||||
@ -373,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
|
||||
@ -397,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
|
||||
@ -421,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
|
||||
@ -446,22 +523,37 @@ trait PolyfillAssertTrait
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a string matches a given regular expression.
|
||||
* @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 function assertMatchesRegularExpression($pattern, $string, $message = '')
|
||||
public static function assertMatchesRegularExpression($pattern, $string, $message = '')
|
||||
{
|
||||
static::assertThat(
|
||||
$string,
|
||||
new LogicalNot(
|
||||
new RegularExpression($pattern)
|
||||
),
|
||||
$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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user