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