You are here

protected function CountrySortTest::setUp in Address 8

Overrides BrowserTestBase::setUp

File

tests/src/Functional/Views/CountrySortTest.php, line 55

Class

CountrySortTest
Tests sorting Views by country.

Namespace

Drupal\Tests\address\Functional\Views

Code

protected function setUp() : void {
  parent::setUp();
  $this->user = $this
    ->drupalCreateUser([
    'access content',
  ]);
  $this
    ->drupalLogin($this->user);

  // This is a good set since the names and codes aren't in the same order.
  $this->countries = [
    'AT' => 'Austria',
    'DE' => 'Germany',
    'FR' => 'France',
    'HR' => 'Croatia',
    'US' => 'United States',
    'VI' => 'U.S. Virgin Islands',
  ];
  foreach ($this->countries as $country_code => $name) {
    $this->nodes[$country_code] = $this
      ->drupalCreateNode([
      'type' => 'address_test',
      'status' => 1,
      'title' => $name,
      'field_address_test' => [
        'country_code' => $country_code,
      ],
    ]);
  }
}