You are here

public function AddressBookTest::testNeedsCopy in Commerce Core 8.2

@covers ::needsCopy

File

modules/order/tests/src/Kernel/AddressBookTest.php, line 186

Class

AddressBookTest
Tests the address book.

Namespace

Drupal\Tests\commerce_order\Kernel

Code

public function testNeedsCopy() {
  $profile = Profile::create([
    'type' => 'customer',
  ]);
  $profile
    ->save();
  $this
    ->assertFalse($this->addressBook
    ->needsCopy($profile));
  $profile = Profile::create([
    'type' => 'customer',
    'data' => [
      'copy_to_address_book' => TRUE,
    ],
  ]);
  $profile
    ->save();
  $this
    ->assertTrue($this->addressBook
    ->needsCopy($profile));
}