NormalizerDenormalizeExceptionsUnitTestBase.php

Namespace

Drupal\Tests\hal\Unit

File

core/modules/hal/tests/src/Unit/NormalizerDenormalizeExceptionsUnitTestBase.php

View source
<?php

namespace Drupal\Tests\hal\Unit;

use Drupal\Tests\UnitTestCase;

/**
 * Common ancestor for FieldItemNormalizerDenormalizeExceptionsUnitTest and
 * FieldNormalizerDenormalizeExceptionsUnitTest as they have the same
 * dataProvider.
 */
abstract class NormalizerDenormalizeExceptionsUnitTestBase extends UnitTestCase {
    
    /**
     * Provides data for FieldItemNormalizerDenormalizeExceptionsUnitTest::testFieldItemNormalizerDenormalizeExceptions()
     * and for FieldNormalizerDenormalizeExceptionsUnitTest::testFieldNormalizerDenormalizeExceptions().
     *
     * @return array Test data.
     */
    public function providerNormalizerDenormalizeExceptions() {
        $mock = $this->getMockBuilder('\\Drupal\\Core\\Field\\Plugin\\DataType\\FieldItem')
            ->setMethods([
            'getParent',
        ])
            ->getMock();
        $mock->expects($this->any())
            ->method('getParent')
            ->will($this->returnValue(NULL));
        return [
            [
                [],
            ],
            [
                [
                    'target_instance' => $mock,
                ],
            ],
        ];
    }

}

Classes

Title Deprecated Summary
NormalizerDenormalizeExceptionsUnitTestBase Common ancestor for FieldItemNormalizerDenormalizeExceptionsUnitTest and FieldNormalizerDenormalizeExceptionsUnitTest as they have the same dataProvider.

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