Commit 66d19eaa authored by webchick's avatar webchick

Issue #2927566 by Wim Leers: Unit test EntityReferenceFieldItemNormalizerTest mocks incorrectly

parent ee22a47c
......@@ -70,7 +70,7 @@ protected function setUp() {
$this->serializer = $this->prophesize(Serializer::class);
// Set up the serializer to return an entity property.
$this->serializer->normalize(Argument::cetera())
->willReturn(['value' => 'test']);
->willReturn('test');
$this->normalizer->setSerializer($this->serializer->reveal());
......@@ -131,7 +131,7 @@ public function testNormalize() {
$normalized = $this->normalizer->normalize($this->fieldItem->reveal());
$expected = [
'target_id' => ['value' => 'test'],
'target_id' => 'test',
'target_type' => 'test_type',
'target_uuid' => '080e3add-f9d5-41ac-9821-eea55b7b42fb',
'url' => $test_url,
......@@ -159,7 +159,7 @@ public function testNormalizeWithNoEntity() {
$normalized = $this->normalizer->normalize($this->fieldItem->reveal());
$expected = [
'target_id' => ['value' => 'test'],
'target_id' => 'test',
];
$this->assertSame($expected, $normalized);
}
......@@ -169,7 +169,7 @@ public function testNormalizeWithNoEntity() {
*/
public function testDenormalizeWithTypeAndUuid() {
$data = [
'target_id' => ['value' => 'test'],
'target_id' => 'test',
'target_type' => 'test_type',
'target_uuid' => '080e3add-f9d5-41ac-9821-eea55b7b42fb',
];
......@@ -193,7 +193,7 @@ public function testDenormalizeWithTypeAndUuid() {
*/
public function testDenormalizeWithUuidWithoutType() {
$data = [
'target_id' => ['value' => 'test'],
'target_id' => 'test',
'target_uuid' => '080e3add-f9d5-41ac-9821-eea55b7b42fb',
];
......@@ -218,7 +218,7 @@ public function testDenormalizeWithUuidWithIncorrectType() {
$this->setExpectedException(UnexpectedValueException::class, 'The field "field_reference" property "target_type" must be set to "test_type" or omitted.');
$data = [
'target_id' => ['value' => 'test'],
'target_id' => 'test',
'target_type' => 'wrong_type',
'target_uuid' => '080e3add-f9d5-41ac-9821-eea55b7b42fb',
];
......@@ -238,7 +238,7 @@ public function testDenormalizeWithTypeWithIncorrectUuid() {
$this->setExpectedException(InvalidArgumentException::class, 'No "test_type" entity found with UUID "unique-but-none-non-existent" for field "field_reference"');
$data = [
'target_id' => ['value' => 'test'],
'target_id' => 'test',
'target_type' => 'test_type',
'target_uuid' => 'unique-but-none-non-existent',
];
......@@ -261,7 +261,7 @@ public function testDenormalizeWithEmtpyUuid() {
$this->setExpectedException(InvalidArgumentException::class, 'If provided "target_uuid" cannot be empty for field "test_type".');
$data = [
'target_id' => ['value' => 'test'],
'target_id' => 'test',
'target_type' => 'test_type',
'target_uuid' => '',
];
......@@ -278,7 +278,7 @@ public function testDenormalizeWithEmtpyUuid() {
*/
public function testDenormalizeWithId() {
$data = [
'target_id' => ['value' => 'test'],
'target_id' => 'test',
];
$this->fieldItem->setValue($data)->shouldBeCalled();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment