function ComputedFileUrlTest::testSetValueNoNotify

Same name and namespace in other branches
  1. 10 core/modules/file/tests/src/Kernel/ComputedFileUrlTest.php \Drupal\Tests\file\Kernel\ComputedFileUrlTest::testSetValueNoNotify()
  2. 11.x core/modules/file/tests/src/Kernel/ComputedFileUrlTest.php \Drupal\Tests\file\Kernel\ComputedFileUrlTest::testSetValueNoNotify()
  3. 9 core/modules/file/tests/src/Kernel/ComputedFileUrlTest.php \Drupal\Tests\file\Kernel\ComputedFileUrlTest::testSetValueNoNotify()
  4. 8.9.x core/modules/file/tests/src/Kernel/ComputedFileUrlTest.php \Drupal\Tests\file\Kernel\ComputedFileUrlTest::testSetValueNoNotify()

Tests set value no notify.

File

core/modules/file/tests/src/Kernel/ComputedFileUrlTest.php, line 81

Class

ComputedFileUrlTest
Tests Drupal\file\ComputedFileUrl.

Namespace

Drupal\Tests\file\Kernel

Code

public function testSetValueNoNotify() : void {
  $name = $this->randomMachineName();
  $parent = $this->prophesize(FieldItemInterface::class);
  $parent->onChange($name)
    ->shouldNotBeCalled();
  $definition = $this->prophesize(DataDefinitionInterface::class);
  $typed_data = new ComputedFileUrl($definition->reveal(), $name, $parent->reveal());
  // Setting the value should explicitly should mean the parent entity is
  // never called into.
  $typed_data->setValue($this->testUrl, FALSE);
  $this->assertSame($this->testUrl, $typed_data->getValue());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.