You are here

protected function CommerceWebDriverTestBase::assertRenderedAddress in Commerce Core 8.2

Asserts that the given address is rendered on the page.

Parameters

array $address: The address.

string $container: The name of the containing profile element. Defaults to 'profile'.

21 calls to CommerceWebDriverTestBase::assertRenderedAddress()
CustomerProfileTest::testIncompleteProfiles in modules/order/tests/src/FunctionalJavascript/CustomerProfileTest.php
Tests switching between incomplete profiles.
CustomerProfileTest::testMultipleAdministrator in modules/order/tests/src/FunctionalJavascript/CustomerProfileTest.php
Tests the address book in "multiple" mode, for administrators.
CustomerProfileTest::testMultipleExisting in modules/order/tests/src/FunctionalJavascript/CustomerProfileTest.php
Tests the address book in "multiple" mode, on an existing profile entity.
CustomerProfileTest::testMultipleNew in modules/order/tests/src/FunctionalJavascript/CustomerProfileTest.php
Tests the address book in "multiple" mode, on a new profile entity.
CustomerProfileTest::testSingleAdministrator in modules/order/tests/src/FunctionalJavascript/CustomerProfileTest.php
Tests the address book in "single" mode, for administrators.

... See full list

File

tests/src/FunctionalJavascript/CommerceWebDriverTestBase.php, line 140

Class

CommerceWebDriverTestBase
Provides a base class for Commerce functional tests.

Namespace

Drupal\Tests\commerce\FunctionalJavascript

Code

protected function assertRenderedAddress(array $address, $container = 'profile') {
  $page = $this
    ->getSession()
    ->getPage();
  $address_text = $page
    ->find('css', 'p.address')
    ->getText();
  foreach ($address as $property => $value) {
    if ($property === 'country_code') {
      $value = $this->countryList[$value];
    }
    $this
      ->assertStringContainsString($value, $address_text);
    $this
      ->assertSession()
      ->fieldNotExists($container . "[address][0][address][{$property}]");
  }
  $this
    ->assertSession()
    ->fieldNotExists($container . '[copy_to_address_book]');
}