Helper for assertParagraphsButtons and assertNoParagraphsButtons.
int $count: Number of paragraphs buttons to look for.
bool $hidden: TRUE if these buttons should not be shown, FALSE otherwise. Defaults to TRUE.
protected function assertParagraphsButtonsHelper($count, $hidden = TRUE) {
for ($i = 0; $i < $count; $i++) {
$remove_button = $this
->xpath('//*[@name="field_paragraphs_demo_' . $i . '_remove"]');
if (!$hidden) {
$this
->assertNotEquals(count($remove_button), 0);
}
else {
$this
->assertEquals(count($remove_button), 0);
}
}
// It is enough to check for the specific paragraph type 'Images' to assert
// the add more buttons presence for this test class.
$add_button = $this
->xpath('//input[@value="Add images"]');
if (!$hidden) {
$this
->assertNotEquals(count($add_button), 0);
}
else {
$this
->assertEquals(count($add_button), 0);
}
}