public function PaymentReferenceBaseTest::testProcessMaxWeight in Payment 8.2
@covers ::processMaxWeight
File
- tests/
src/ Unit/ Element/ PaymentReferenceBaseTest.php, line 868
Class
- PaymentReferenceBaseTest
- @coversDefaultClass \Drupal\payment\Element\PaymentReferenceBase
Namespace
Drupal\Tests\payment\Unit\ElementCode
public function testProcessMaxWeight() {
$sibling_weight_1 = mt_rand();
$sibling_weight_2 = mt_rand();
$form = array(
'foo' => array(
'bar' => array(
'sibling_1' => array(
'#weight' => $sibling_weight_1,
),
'sibling_2' => array(
'#weight' => $sibling_weight_2,
),
'subject' => array(
'#array_parents' => array(
'foo',
'bar',
'subject',
),
),
),
),
);
$element = $form['foo']['bar']['subject'];
$form_state = $this
->createMock(FormStateInterface::class);
$element_plugin = $this->sut;
$element = $element_plugin::processMaxWeight($element, $form_state, $form);
$this
->assertGreaterThan(max($sibling_weight_1, $sibling_weight_2), $element['#weight']);
}