public function ZoneItemTest::testZone in Address 8
Tests storing and retrieving a zone from the field.
File
- tests/src/ Kernel/ ZoneItemTest.php, line 63 
Class
- ZoneItemTest
- Tests the address_zone field.
Namespace
Drupal\Tests\address\KernelCode
public function testZone() {
  $zone = new Zone([
    'id' => 'test',
    'label' => 'Test',
    'territories' => [
      [
        'country_code' => 'HU',
      ],
      [
        'country_code' => 'RS',
      ],
    ],
  ]);
  $this->testEntity->field_zone = $zone;
  $this->testEntity
    ->save();
  $this->testEntity = $this
    ->reloadEntity($this->testEntity);
  $this
    ->assertEquals($zone, $this->testEntity->field_zone->value);
}