protected function LinkOutputLocationTest::assertPseudofieldHelper in Flag 8.4
Helper for assertPseudofield() and assertNoPseudofield().
It is not recommended to call this function directly.
Parameters
\Drupal\flag\FlagInterface $flag: The flag to look for.
\Drupal\Core\Entity\EntityInterface $entity: The flaggable entity the flag is on.
string $message: Message to display.
bool $exists: TRUE if the flag link should exist, FALSE if it should not exist.
2 calls to LinkOutputLocationTest::assertPseudofieldHelper()
- LinkOutputLocationTest::assertNoPseudofield in tests/
src/ Functional/ LinkOutputLocationTest.php - Pass if the flag link is not shown as a field on the page.
- LinkOutputLocationTest::assertPseudofield in tests/
src/ Functional/ LinkOutputLocationTest.php - Pass if the flag link is shown as a field on the page.
File
- tests/
src/ Functional/ LinkOutputLocationTest.php, line 210
Class
- LinkOutputLocationTest
- Tests the Flag link is output in various locations.
Namespace
Drupal\Tests\flag\FunctionalCode
protected function assertPseudofieldHelper(FlagInterface $flag, EntityInterface $entity, $message, $exists) {
$xpath = $this
->xpath("//*[contains(@class, 'node__content')]//div[contains(@class, :id)]", [
':id' => 'flag-' . $flag
->id() . '-' . $entity
->id(),
]);
$this
->assert(count($xpath) == ($exists ? 1 : 0), $message);
}