You are here

public function AdministrativeAreaFilterTest::testStaticCountryAdministrativeAreaOptions in Address 8

Test options for administrative area using a static country code.

File

tests/src/Functional/Views/AdministrativeAreaFilterTest.php, line 51

Class

AdministrativeAreaFilterTest
Tests the administrative area Views filter for Address fields.

Namespace

Drupal\Tests\address\Functional\Views

Code

public function testStaticCountryAdministrativeAreaOptions() {
  $view = Views::getView('address_test_filter_administrative_area');
  $filters = $view
    ->getDisplay()
    ->getOption('filters');
  $filters['field_address_test_administrative_area']['country']['country_source'] = 'static';
  $filters['field_address_test_administrative_area']['country']['country_static_code'] = 'BR';
  $view
    ->getDisplay()
    ->overrideOption('filters', $filters);
  $view
    ->save();
  $this
    ->drupalGet('address-test/views/filter-administrative-area');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->fieldExists('field_address_test_administrative_area');
  $this
    ->assertAdministrativeAreaOptions('BR');
}