You are here

public static function SchemaNameBase::testDefaultValue in Schema.org Metatag 7

Provide a random test value.

A helper function to create a random test value. Use the delimiter to create comma-separated values, or a few "words" separated by spaces.

Value must be static so the test can retrieve the value without instantiating the class.

Parameters

int $count: Number of "words".

int $delimiter: Delimiter used to connect "words".

Return value

mixed Return the test value, either a string or array, depending on the property.

Overrides SchemaMetatagTestTagInterface::testDefaultValue

30 calls to SchemaNameBase::testDefaultValue()
SchemaActionBase::testValue in src/SchemaActionBase.php
Provide a test input value for the property that will validate.
SchemaAddressBase::testValue in src/SchemaAddressBase.php
Provide a test input value for the property that will validate.
SchemaAnswerBase::testValue in src/SchemaAnswerBase.php
Provide a test input value for the property that will validate.
SchemaBrandBase::testValue in src/SchemaBrandBase.php
Provide a test input value for the property that will validate.
SchemaContactPointBase::testValue in src/SchemaContactPointBase.php
Provide a test input value for the property that will validate.

... See full list

File

src/SchemaNameBase.php, line 269

Class

SchemaNameBase
All Schema.org tags should extend this class.

Code

public static function testDefaultValue($count = NULL, $delimiter = NULL) {
  $items = [];
  $min = 1;
  $max = isset($count) ? $count : 2;
  $delimiter = isset($delimiter) ? $delimiter : ' ';
  for ($i = $min; $i <= $max; $i++) {
    $items[] = SchemaMetatagManager::randomMachineName();
  }
  return implode($delimiter, $items);
}