public function UserRoleTest::testPrepareValueReferenceNotFound in Feeds 8.3
Tests prepareValue() method without match.
@covers ::prepareValue @covers ::findEntity
File
- tests/
src/ Unit/ Feeds/ Target/ UserRoleTest.php, line 134
Class
- UserRoleTest
- @coversDefaultClass \Drupal\feeds\Feeds\Target\UserRole @group feeds
Namespace
Drupal\Tests\feeds\Unit\Feeds\TargetCode
public function testPrepareValueReferenceNotFound() {
$this->entityFinder
->findEntities($this
->getReferencableEntityTypeId(), 'label', 'Bar')
->willReturn([])
->shouldBeCalled();
$method = $this
->getProtectedClosure($this
->createTargetPluginInstance(), 'prepareValue');
$values = [
'target_id' => 'Bar',
];
$this
->expectException(ReferenceNotFoundException::class);
$this
->expectExceptionMessage("The role <em class=\"placeholder\">Bar</em> cannot be assigned because it does not exist.");
$method(0, $values);
}