function FieldNormalizerDenormalizeExceptionsTest::providerNormalizerDenormalizeExceptions

Provides data for field normalization tests.

Return value

array The context of the normalizer.

File

core/modules/hal/tests/src/Unit/FieldNormalizerDenormalizeExceptionsTest.php, line 54

Class

FieldNormalizerDenormalizeExceptionsTest
Tests the exceptions thrown by FieldNormalizer and FieldItemNormalizer.

Namespace

Drupal\Tests\hal\Unit

Code

public function providerNormalizerDenormalizeExceptions() {
    $mock = $this->getMockBuilder('\\Drupal\\Core\\Field\\Plugin\\DataType\\FieldItem')
        ->addMethods([
        'getParent',
    ])
        ->getMock();
    $mock->expects($this->any())
        ->method('getParent')
        ->willReturn(NULL);
    return [
        [
            [],
        ],
        [
            [
                'target_instance' => $mock,
            ],
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.