PHPUnit_Framework_Assert::assertStringMatchesFormatFile PHP Method

assertStringMatchesFormatFile() public static method

Asserts that a string matches a given format file.
public static assertStringMatchesFormatFile ( string $formatFile, string $string, string $message = '' )
$formatFile string
$string string
$message string
    public static function assertStringMatchesFormatFile($formatFile, $string, $message = '')
    {
        static::assertFileExists($formatFile, $message);
        if (!is_string($string)) {
            throw PHPUnit_Util_InvalidArgumentHelper::factory(2, 'string');
        }
        $constraint = new PHPUnit_Framework_Constraint_StringMatches(file_get_contents($formatFile));
        static::assertThat($string, $constraint, $message);
    }

Usage Example

Example #1
0
/**
 * Asserts that a string matches a given format file.
 *
 * @param  string $formatFile
 * @param  string $string
 * @param  string $message
 * @since  Method available since Release 3.5.0
 */
function assertStringMatchesFormatFile($formatFile, $string, $message = '')
{
    return PHPUnit_Framework_Assert::assertStringMatchesFormatFile($formatFile, $string, $message);
}
All Usage Examples Of PHPUnit_Framework_Assert::assertStringMatchesFormatFile
PHPUnit_Framework_Assert