You are here

public function RowTest::testSourceFreeze in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/migrate/tests/src/Unit/RowTest.php \Drupal\Tests\migrate\Unit\RowTest::testSourceFreeze()
  2. 10 core/modules/migrate/tests/src/Unit/RowTest.php \Drupal\Tests\migrate\Unit\RowTest::testSourceFreeze()

Tests source immutability after freeze.

File

core/modules/migrate/tests/src/Unit/RowTest.php, line 125

Class

RowTest
@coversDefaultClass \Drupal\migrate\Row @group migrate

Namespace

Drupal\Tests\migrate\Unit

Code

public function testSourceFreeze() {
  $row = new Row($this->testValues, $this->testSourceIds);
  $row
    ->rehash();
  $this
    ->assertSame($this->testHash, $row
    ->getHash(), 'Correct hash.');
  $row
    ->setSourceProperty('title', 'new title');
  $row
    ->rehash();
  $this
    ->assertSame($this->testHashMod, $row
    ->getHash(), 'Hash changed correctly.');
  $row
    ->freezeSource();
  $this
    ->expectException(\Exception::class);
  $row
    ->setSourceProperty('title', 'new title');
}