You are here

public function RadioactivityFunctionTestTrait::getPageEnergyValues in Radioactivity 8.3

Same name and namespace in other branches
  1. 4.0.x tests/src/Traits/RadioactivityFunctionTestTrait.php \Drupal\Tests\radioactivity\Traits\RadioactivityFunctionTestTrait::getPageEnergyValues()

Gets the field's energy values from the session's page.

Parameters

string $fieldName: The name of the field to be asserted.

Return value

array The field values.

1 call to RadioactivityFunctionTestTrait::getPageEnergyValues()
RadioactivityFunctionTestTrait::assertPageEnergyValue in tests/src/Traits/RadioactivityFunctionTestTrait.php
Assert the energy values from the page.

File

tests/src/Traits/RadioactivityFunctionTestTrait.php, line 397

Class

RadioactivityFunctionTestTrait
Radioactivity functional test trait.

Namespace

Drupal\Tests\radioactivity\Traits

Code

public function getPageEnergyValues($fieldName) {
  $values = [];
  $fieldBaseName = substr($fieldName, 6);
  $selector = '.field--name-field-' . $fieldBaseName . ' .field__item';
  $rows = $this
    ->getSession()
    ->getPage()
    ->findAll('css', $selector);
  if ($rows) {
    foreach ($rows as $row) {
      $values[] = $row
        ->getHtml();
    }
  }
  return $values;
}