[PhpUnitBridge] Polyfill new phpunit 9.1 assertions
This commit is contained in:
parent
831966981b
commit
d945b88c1a
@ -12,7 +12,7 @@ CHANGELOG
|
|||||||
-----
|
-----
|
||||||
|
|
||||||
* added `ClassExistsMock`
|
* 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
|
* split simple-phpunit bin into php file with code and a shell script
|
||||||
|
|
||||||
4.1.0
|
4.1.0
|
||||||
|
@ -277,6 +277,17 @@ trait PolyfillAssertTrait
|
|||||||
static::assertFalse(is_readable($filename), $message ? $message : "Failed asserting that $filename is not readable.");
|
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 $filename
|
||||||
* @param string $message
|
* @param string $message
|
||||||
@ -301,6 +312,17 @@ trait PolyfillAssertTrait
|
|||||||
static::assertFalse(is_writable($filename), $message ? $message : "Failed asserting that $filename is not writable.");
|
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 $directory
|
||||||
* @param string $message
|
* @param string $message
|
||||||
@ -325,6 +347,17 @@ trait PolyfillAssertTrait
|
|||||||
static::assertFalse(is_dir($directory), $message ? $message : "Failed asserting that $directory does not exist.");
|
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 $directory
|
||||||
* @param string $message
|
* @param string $message
|
||||||
@ -349,6 +382,17 @@ trait PolyfillAssertTrait
|
|||||||
static::assertNotIsReadable($directory, $message);
|
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 $directory
|
||||||
* @param string $message
|
* @param string $message
|
||||||
@ -373,6 +417,17 @@ trait PolyfillAssertTrait
|
|||||||
static::assertNotIsWritable($directory, $message);
|
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 $filename
|
||||||
* @param string $message
|
* @param string $message
|
||||||
@ -397,6 +452,17 @@ trait PolyfillAssertTrait
|
|||||||
static::assertFalse(file_exists($filename), $message ? $message : "Failed asserting that $filename does not exist.");
|
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 $filename
|
||||||
* @param string $message
|
* @param string $message
|
||||||
@ -421,6 +487,17 @@ trait PolyfillAssertTrait
|
|||||||
static::assertNotIsReadable($filename, $message);
|
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 $filename
|
||||||
* @param string $message
|
* @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 $pattern
|
||||||
* @param string $string
|
* @param string $string
|
||||||
* @param string $message
|
* @param string $message
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function assertMatchesRegularExpression($pattern, $string, $message = '')
|
public static function assertMatchesRegularExpression($pattern, $string, $message = '')
|
||||||
{
|
{
|
||||||
static::assertThat(
|
static::assertRegExp($pattern, $string, $message);
|
||||||
$string,
|
}
|
||||||
new LogicalNot(
|
|
||||||
new RegularExpression($pattern)
|
/**
|
||||||
),
|
* @param string $pattern
|
||||||
$message
|
* @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