PHPUnit_Framework_Assert::assertStringStartsWith PHP Method

assertStringStartsWith() public static method

Asserts that a string starts with a given prefix.
public static assertStringStartsWith ( string $prefix, string $string, string $message = '' )
$prefix string
$string string
$message string
    public static function assertStringStartsWith($prefix, $string, $message = '')
    {
        if (!is_string($prefix)) {
            throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
        }
        if (!is_string($string)) {
            throw PHPUnit_Util_InvalidArgumentHelper::factory(2, 'string');
        }
        $constraint = new PHPUnit_Framework_Constraint_StringStartsWith($prefix);
        static::assertThat($string, $constraint, $message);
    }

Usage Example

 /**
  * @param $stepMethodName string
  * @param $encodedStepArguments string
  */
 protected function callStepInSubProcess($stepMethodName, $encodedStepArguments = '', $withoutSecurityChecks = FALSE)
 {
     if (strpos($stepMethodName, '::') !== 0) {
         $stepMethodName = substr($stepMethodName, strpos($stepMethodName, '::') + 2);
     }
     $withoutSecurityChecks = $withoutSecurityChecks === TRUE ? '--without-security-checks ' : '';
     $subProcessCommand = sprintf('typo3.flow.tests.functional:behathelper:callbehatstep %s%s %s%s', $withoutSecurityChecks, escapeshellarg($this->behatTestHelperObjectName), $stepMethodName, $encodedStepArguments);
     $subProcessResponse = $this->getSubProcess()->execute($subProcessCommand);
     Assert::assertStringStartsWith('SUCCESS:', $subProcessResponse, 'We called "' . $subProcessCommand . '" and got: ' . $subProcessResponse);
 }
All Usage Examples Of PHPUnit_Framework_Assert::assertStringStartsWith
PHPUnit_Framework_Assert