Assert\Assertion::contains PHP Method

contains() public static method

Assert that string contains a sequence of chars.
public static contains ( mixed $string, string $needle, string | null $message = null, string | null $propertyPath = null, string $encoding = 'utf8' ) : boolean
$string mixed
$needle string
$message string | null
$propertyPath string | null
$encoding string
return boolean
    public static function contains($string, $needle, $message = null, $propertyPath = null, $encoding = 'utf8')
    {
        static::string($string, $message, $propertyPath);
        if (mb_strpos($string, $needle, null, $encoding) === false) {
            $message = sprintf($message ?: 'Value "%s" does not contain "%s".', static::stringify($string), static::stringify($needle));
            $constraints = array('needle' => $needle, 'encoding' => $encoding);
            throw static::createException($string, $message, static::INVALID_STRING_CONTAINS, $propertyPath, $constraints);
        }
        return true;
    }

Usage Example

 /**
  * @Then I should see the logging messages
  */
 public function iShouldSeeTheLoggingMessages()
 {
     $display = $this->display;
     Assertion::contains($display, 'purging database');
     Assertion::contains($display, 'AppBundle\\DataFixtures\\ORM\\RoleFixture');
     Assertion::contains($display, 'AppBundle\\DataFixtures\\ORM\\AdminFixture');
 }
All Usage Examples Of Assert\Assertion::contains