ZoneTerritoryElementTest.php in Address 8
File
tests/src/FunctionalJavascript/ZoneTerritoryElementTest.php
View source
<?php
namespace Drupal\Tests\address\FunctionalJavascript;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
class ZoneTerritoryElementTest extends WebDriverTestBase {
protected static $modules = [
'system',
'user',
'field',
'node',
'address',
'address_test',
];
protected $defaultTheme = 'stark';
public function testZoneTerritory() {
$this
->drupalGet('/address_test/zone_territory_test_form');
$this
->getSession()
->getPage()
->selectFieldOption('territory[country_code]', 'US');
$this
->assertSession()
->assertWaitOnAjaxRequest();
$this
->assertSession()
->fieldExists('territory[administrative_area]');
$this
->assertSession()
->fieldExists('territory[limit_by_postal_code]');
$this
->getSession()
->getPage()
->checkField('territory[limit_by_postal_code]');
$this
->assertSession()
->assertWaitOnAjaxRequest();
$this
->assertSession()
->fieldExists('territory[included_postal_codes]');
$this
->assertSession()
->fieldExists('territory[excluded_postal_codes]');
$this
->submitForm([
'territory[administrative_area]' => 'SC',
'territory[included_postal_codes]' => '29601',
'territory[excluded_postal_codes]' => '29602',
], 'Submit');
$this
->assertSession()
->pageTextContains('Submitted: US / SC / 29601 / 29602.');
}
}