function ComputedFileUrlTest::testSetValueNoNotify

Same name in other branches
  1. 9 core/modules/file/tests/src/Kernel/ComputedFileUrlTest.php \Drupal\Tests\file\Kernel\ComputedFileUrlTest::testSetValueNoNotify()
  2. 8.9.x core/modules/file/tests/src/Kernel/ComputedFileUrlTest.php \Drupal\Tests\file\Kernel\ComputedFileUrlTest::testSetValueNoNotify()
  3. 11.x 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 77

Class

ComputedFileUrlTest
@coversDefaultClass \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.