Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add renamed methods to 8.5 #4210

Closed
120 changes: 120 additions & 0 deletions src/Framework/Assert.php
Expand Up @@ -1355,6 +1355,17 @@ public static function assertIsReadable(string $filename, string $message = ''):
static::assertThat($filename, new IsReadable, $message);
}

/**
* Asserts that a file/dir exists and is not readable.
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
public static function assertIsNotReadable(string $filename, string $message = ''): void
{
static::assertThat($filename, new LogicalNot(new IsReadable), $message);
}

/**
* Asserts that a file/dir exists and is not readable.
*
Expand All @@ -1377,6 +1388,17 @@ public static function assertIsWritable(string $filename, string $message = ''):
static::assertThat($filename, new IsWritable, $message);
}

/**
* Asserts that a file/dir exists and is not writable.
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
public static function assertIsNotWritable(string $filename, string $message = ''): void
{
static::assertThat($filename, new LogicalNot(new IsWritable), $message);
}

/**
* Asserts that a file/dir exists and is not writable.
*
Expand All @@ -1399,6 +1421,17 @@ public static function assertDirectoryExists(string $directory, string $message
static::assertThat($directory, new DirectoryExists, $message);
}

/**
* Asserts that a directory does not exist.
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
public static function assertDirectoryDoesNotExist(string $directory, string $message = ''): void
{
static::assertThat($directory, new LogicalNot(new DirectoryExists), $message);
}

/**
* Asserts that a directory does not exist.
*
Expand All @@ -1422,6 +1455,18 @@ public static function assertDirectoryIsReadable(string $directory, string $mess
self::assertIsReadable($directory, $message);
}

/**
* Asserts that a directory exists and is not readable.
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
public static function assertDirectoryIsNotReadable(string $directory, string $message = ''): void
{
self::assertDirectoryExists($directory, $message);
self::assertIsNotReadable($directory, $message);
}

/**
* Asserts that a directory exists and is not readable.
*
Expand All @@ -1446,6 +1491,18 @@ public static function assertDirectoryIsWritable(string $directory, string $mess
self::assertIsWritable($directory, $message);
}

/**
* Asserts that a directory exists and is not writable.
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
public static function assertDirectoryIsNotWritable(string $directory, string $message = ''): void
{
self::assertDirectoryExists($directory, $message);
self::assertIsNotWritable($directory, $message);
}

/**
* Asserts that a directory exists and is not writable.
*
Expand All @@ -1469,6 +1526,17 @@ public static function assertFileExists(string $filename, string $message = ''):
static::assertThat($filename, new FileExists, $message);
}

/**
* Asserts that a file does not exist.
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
public static function assertFileDoesNotExist(string $filename, string $message = ''): void
{
static::assertThat($filename, new LogicalNot(new FileExists), $message);
}

/**
* Asserts that a file does not exist.
*
Expand All @@ -1492,6 +1560,18 @@ public static function assertFileIsReadable(string $file, string $message = ''):
self::assertIsReadable($file, $message);
}

/**
* Asserts that a file exists and is not readable.
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
public static function assertFileIsNotReadable(string $file, string $message = ''): void
{
self::assertFileExists($file, $message);
self::assertIsNotReadable($file, $message);
}

/**
* Asserts that a file exists and is not readable.
*
Expand All @@ -1516,6 +1596,18 @@ public static function assertFileIsWritable(string $file, string $message = ''):
self::assertIsWritable($file, $message);
}

/**
* Asserts that a file exists and is not writable.
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
public static function assertFileIsNotWritable(string $file, string $message = ''): void
{
self::assertFileExists($file, $message);
self::assertIsNotWritable($file, $message);
}

/**
* Asserts that a file exists and is not writable.
*
Expand Down Expand Up @@ -2443,6 +2535,17 @@ public static function assertAttributeNotInternalType(string $expected, string $
);
}

/**
* Asserts that a string matches a given regular expression.
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
public static function assertMatchesRegularExpression(string $pattern, string $string, string $message = ''): void
{
static::assertThat($string, new RegularExpression($pattern), $message);
}

/**
* Asserts that a string matches a given regular expression.
*
Expand All @@ -2454,6 +2557,23 @@ public static function assertRegExp(string $pattern, string $string, string $mes
static::assertThat($string, new RegularExpression($pattern), $message);
}

/**
* Asserts that a string does not match a given regular expression.
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
public static function assertDoesNotMatchRegularExpression(string $pattern, string $string, string $message = ''): void
{
static::assertThat(
$string,
new LogicalNot(
new RegularExpression($pattern)
),
$message
);
}

/**
* Asserts that a string does not match a given regular expression.
*
Expand Down
130 changes: 130 additions & 0 deletions src/Framework/Assert/Functions.php
Expand Up @@ -876,6 +876,19 @@ function assertIsReadable(string $filename, string $message = ''): void
Assert::assertIsReadable(...\func_get_args());
}

/**
* Asserts that a file/dir exists and is not readable.
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*
* @see Assert::assertIsNotReadable
*/
function assertIsNotReadable(string $filename, string $message = ''): void
{
Assert::assertIsNotReadable(...\func_get_args());
}

/**
* Asserts that a file/dir exists and is not readable.
*
Expand All @@ -902,6 +915,19 @@ function assertIsWritable(string $filename, string $message = ''): void
Assert::assertIsWritable(...\func_get_args());
}

/**
* Asserts that a file/dir exists and is not writable.
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*
* @see Assert::assertIsNotWritable
*/
function assertIsNotWritable(string $filename, string $message = ''): void
{
Assert::assertIsNotWritable(...\func_get_args());
}

/**
* Asserts that a file/dir exists and is not writable.
*
Expand All @@ -928,6 +954,19 @@ function assertDirectoryExists(string $directory, string $message = ''): void
Assert::assertDirectoryExists(...\func_get_args());
}

/**
* Asserts that a directory does not exist.
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*
* @see Assert::assertDirectoryDoesNotExist
*/
function assertDirectoryDoesNotExist(string $directory, string $message = ''): void
{
Assert::assertDirectoryDoesNotExist(...\func_get_args());
}

/**
* Asserts that a directory does not exist.
*
Expand All @@ -954,6 +993,19 @@ function assertDirectoryIsReadable(string $directory, string $message = ''): voi
Assert::assertDirectoryIsReadable(...\func_get_args());
}

/**
* Asserts that a directory exists and is not readable.
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*
* @see Assert::assertDirectoryIsNotReadable
*/
function assertDirectoryIsNotReadable(string $directory, string $message = ''): void
{
Assert::assertDirectoryIsNotReadable(...\func_get_args());
}

/**
* Asserts that a directory exists and is not readable.
*
Expand All @@ -980,6 +1032,19 @@ function assertDirectoryIsWritable(string $directory, string $message = ''): voi
Assert::assertDirectoryIsWritable(...\func_get_args());
}

/**
* Asserts that a directory exists and is not writable.
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*
* @see Assert::assertDirectoryIsNotWritable
*/
function assertDirectoryIsNotWritable(string $directory, string $message = ''): void
{
Assert::assertDirectoryIsNotWritable(...\func_get_args());
}

/**
* Asserts that a directory exists and is not writable.
*
Expand All @@ -1006,6 +1071,19 @@ function assertFileExists(string $filename, string $message = ''): void
Assert::assertFileExists(...\func_get_args());
}

/**
* Asserts that a file does not exist.
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*
* @see Assert::assertFileDoesNotExist
*/
function assertFileDoesNotExist(string $filename, string $message = ''): void
{
Assert::assertFileDoesNotExist(...\func_get_args());
}

/**
* Asserts that a file does not exist.
*
Expand All @@ -1032,6 +1110,19 @@ function assertFileIsReadable(string $file, string $message = ''): void
Assert::assertFileIsReadable(...\func_get_args());
}

/**
* Asserts that a file exists and is not readable.
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*
* @see Assert::assertFileIsNotReadable
*/
function assertFileIsNotReadable(string $file, string $message = ''): void
{
Assert::assertFileIsNotReadable(...\func_get_args());
}

/**
* Asserts that a file exists and is not readable.
*
Expand All @@ -1058,6 +1149,19 @@ function assertFileIsWritable(string $file, string $message = ''): void
Assert::assertFileIsWritable(...\func_get_args());
}

/**
* Asserts that a file exists and is not writable.
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*
* @see Assert::assertFileIsNotWritable
*/
function assertFileIsNotWritable(string $file, string $message = ''): void
{
Assert::assertFileIsNotWritable(...\func_get_args());
}

/**
* Asserts that a file exists and is not writable.
*
Expand Down Expand Up @@ -1840,6 +1944,19 @@ function assertAttributeNotInternalType(string $expected, string $attributeName,
Assert::assertAttributeNotInternalType(...\func_get_args());
}

/**
* Asserts that a string matches a given regular expression.
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*
* @see Assert::assertMatchesRegularExpression
*/
function assertMatchesRegularExpression(string $pattern, string $string, string $message = ''): void
{
Assert::assertMatchesRegularExpression(...\func_get_args());
}

/**
* Asserts that a string matches a given regular expression.
*
Expand All @@ -1853,6 +1970,19 @@ function assertRegExp(string $pattern, string $string, string $message = ''): vo
Assert::assertRegExp(...\func_get_args());
}

/**
* Asserts that a string does not match a given regular expression.
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*
* @see Assert::assertDoesNotMatchRegularExpression
*/
function assertDoesNotMatchRegularExpression(string $pattern, string $string, string $message = ''): void
{
Assert::assertDoesNotMatchRegularExpression(...\func_get_args());
}

/**
* Asserts that a string does not match a given regular expression.
*
Expand Down