protected function ParagraphsTranslationTest::assertParagraphsButtonsHelper in Paragraphs 8
Same name in this branch
- 8 tests/src/Functional/WidgetLegacy/ParagraphsTranslationTest.php \Drupal\Tests\paragraphs\Functional\WidgetLegacy\ParagraphsTranslationTest::assertParagraphsButtonsHelper()
- 8 tests/src/Functional/WidgetStable/ParagraphsTranslationTest.php \Drupal\Tests\paragraphs\Functional\WidgetStable\ParagraphsTranslationTest::assertParagraphsButtonsHelper()
Helper for assertParagraphsButtons and assertNoParagraphsButtons.
Parameters
int $count: Number of paragraphs buttons to look for.
bool $hidden: TRUE if these buttons should not be shown, FALSE otherwise. Defaults to TRUE.
2 calls to ParagraphsTranslationTest::assertParagraphsButtonsHelper()
- ParagraphsTranslationTest::assertNoParagraphsButtons in tests/
src/ Functional/ WidgetStable/ ParagraphsTranslationTest.php - Passes if the paragraphs buttons are NOT present.
- ParagraphsTranslationTest::assertParagraphsButtons in tests/
src/ Functional/ WidgetStable/ ParagraphsTranslationTest.php - Passes if the paragraphs buttons are present.
File
- tests/
src/ Functional/ WidgetStable/ ParagraphsTranslationTest.php, line 895
Class
- ParagraphsTranslationTest
- Tests the configuration of paragraphs.
Namespace
Drupal\Tests\paragraphs\Functional\WidgetStableCode
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);
}
}