lithium\test\Unit::assertStringStartsWith()

public method

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

boolean

true 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
		]);
	}