public function ComputedFileUrlTest::testSetValueNoNotify in Drupal 8
Same name and namespace in other branches
- 9 core/modules/file/tests/src/Kernel/ComputedFileUrlTest.php \Drupal\Tests\file\Kernel\ComputedFileUrlTest::testSetValueNoNotify()
- 10 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\KernelCode
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());
}