You are here

public function ComputedFileUrlTest::testSetValueNoNotify in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/file/tests/src/Kernel/ComputedFileUrlTest.php \Drupal\Tests\file\Kernel\ComputedFileUrlTest::testSetValueNoNotify()
  2. 9 core/modules/file/tests/src/Kernel/ComputedFileUrlTest.php \Drupal\Tests\file\Kernel\ComputedFileUrlTest::testSetValueNoNotify()

@covers ::setValue

File

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

Class

ComputedFileUrlTest
@coversDefaultClass \Drupal\file\ComputedFileUrl

Namespace

Drupal\Tests\file\Kernel

Code

public function testSetValueNoNotify() {
  $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());
}