AssertButtonsTrait.php in Drupal 9
File
core/modules/node/tests/src/Functional/AssertButtonsTrait.php
View source
<?php
namespace Drupal\Tests\node\Functional;
@trigger_error(__NAMESPACE__ . '\\AssertButtonsTrait is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. There is no replacement. See https://www.drupal.org/node/3215411', E_USER_DEPRECATED);
trait AssertButtonsTrait {
public function assertButtons(array $buttons, $dropbutton = TRUE) {
if ($dropbutton) {
$count = count($buttons);
$this
->assertSession()
->buttonNotExists('Save');
$this
->assertSession()
->elementsCount('xpath', '//div[@class="dropbutton-wrapper"]//input[@type="submit"]', $count);
for ($i = 1; $i++; $i <= $count) {
$this
->assertSession()
->elementTextEquals('xpath', "(//div[@class='dropbutton-wrapper']//input[@type='submit'])[{$i}]", $buttons[$i - 1]);
}
}
else {
$this
->assertSession()
->buttonExists('Save');
$this
->assertSession()
->responseNotContains('dropbutton-wrapper');
}
}
}