lithium\test\Unit::assertStringEndsWith()
Assert given result string has given suffix.
$this->assertStringEndsWith('bar', 'foobar'); // succeeds
$this->assertStringEndsWith('foo', 'foobar'); // fails
Parameters
-
string
$expected
The suffix to check for.
-
string
$actual
-
string|boolean
$message
Returns
booleantrue
if the assertion succeeded, false
otherwise.
Source
public function assertStringEndsWith($expected, $actual, $message = '{:message}') {
return $this->assert(preg_match("/$expected$/", $actual, $matches) === 1, $message, [
'expected' => $expected,
'result' => $actual
]);
}