You are here

public function PaymentReferenceBaseTest::testAjaxRefresh in Payment 8.2

@covers ::ajaxRefresh

File

tests/src/Unit/Element/PaymentReferenceBaseTest.php, line 493

Class

PaymentReferenceBaseTest
@coversDefaultClass \Drupal\payment\Element\PaymentReferenceBase

Namespace

Drupal\Tests\payment\Unit\Element

Code

public function testAjaxRefresh() {
  $form = array(
    'foo' => array(
      'bar' => array(
        'container' => array(
          '#id' => $this
            ->randomMachineName(),
          'refresh' => array(
            '#array_parents' => array(
              'foo',
              'bar',
              'container',
              'refresh',
            ),
          ),
        ),
      ),
    ),
  );
  $form_state = $this
    ->createMock(FormStateInterface::class);
  $form_state
    ->expects($this
    ->once())
    ->method('getTriggeringElement')
    ->willReturn($form['foo']['bar']['container']['refresh']);
  $response = $this->sut
    ->ajaxRefresh($form, $form_state);
  $this
    ->assertInstanceOf(AjaxResponse::class, $response);
}