Version 1
[yaffs-website] / web / core / modules / hal / tests / src / Unit / NormalizerDenormalizeExceptionsUnitTestBase.php
diff --git a/web/core/modules/hal/tests/src/Unit/NormalizerDenormalizeExceptionsUnitTestBase.php b/web/core/modules/hal/tests/src/Unit/NormalizerDenormalizeExceptionsUnitTestBase.php
new file mode 100644 (file)
index 0000000..d1a3b9b
--- /dev/null
@@ -0,0 +1,31 @@
+<?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->getMock('\Drupal\Core\Field\Plugin\DataType\FieldItem', ['getParent']);
+    $mock->expects($this->any())
+      ->method('getParent')
+      ->will($this->returnValue(NULL));
+    return [
+      [[]],
+      [['target_instance' => $mock]],
+    ];
+  }
+
+}