Drupal 8.0.0 beta 12. More info: https://www.drupal.org/node/2514176
This commit is contained in:
commit
9921556621
13277 changed files with 1459781 additions and 0 deletions
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\hal\Unit\FieldItemNormalizerDenormalizeExceptionsUnitTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\hal\Unit;
|
||||
|
||||
use Drupal\hal\Normalizer\FieldItemNormalizer;
|
||||
|
||||
/**
|
||||
* @coversDefaultClass \Drupal\hal\Normalizer\FieldItemNormalizer
|
||||
* @group hal
|
||||
*/
|
||||
class FieldItemNormalizerDenormalizeExceptionsUnitTest extends NormalizerDenormalizeExceptionsUnitTestBase {
|
||||
|
||||
/**
|
||||
* Tests that the FieldItemNormalizer::denormalize() throws proper exceptions.
|
||||
*
|
||||
* @param array $context
|
||||
* Context for FieldItemNormalizer::denormalize().
|
||||
*
|
||||
* @dataProvider providerNormalizerDenormalizeExceptions
|
||||
* @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
|
||||
*/
|
||||
public function testFieldItemNormalizerDenormalizeExceptions($context) {
|
||||
$field_item_normalizer = new FieldItemNormalizer();
|
||||
$data = array();
|
||||
$class = array();
|
||||
$field_item_normalizer->denormalize($data, $class, NULL, $context);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\hal\Unit\FieldNormalizerDenormalizeExceptionsUnitTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\Tests\hal\Unit;
|
||||
|
||||
use Drupal\hal\Normalizer\FieldNormalizer;
|
||||
|
||||
/**
|
||||
* @coversDefaultClass \Drupal\hal\Normalizer\FieldNormalizer
|
||||
* @group hal
|
||||
*/
|
||||
class FieldNormalizerDenormalizeExceptionsUnitTest extends NormalizerDenormalizeExceptionsUnitTestBase {
|
||||
|
||||
/**
|
||||
* Tests that the FieldNormalizer::denormalize() throws proper exceptions.
|
||||
*
|
||||
* @param array $context
|
||||
* Context for FieldNormalizer::denormalize().
|
||||
*
|
||||
* @dataProvider providerNormalizerDenormalizeExceptions
|
||||
* @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
|
||||
*/
|
||||
public function testFieldNormalizerDenormalizeExceptions($context) {
|
||||
$field_item_normalizer = new FieldNormalizer();
|
||||
$data = array();
|
||||
$class = array();
|
||||
$field_item_normalizer->denormalize($data, $class, NULL, $context);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\Tests\hal\Unit\NormalizerDenormalizeExceptionsUnitTestBase.
|
||||
*/
|
||||
|
||||
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', array('getParent'));
|
||||
$mock->expects($this->any())
|
||||
->method('getParent')
|
||||
->will($this->returnValue(NULL));
|
||||
return array(
|
||||
array(array()),
|
||||
array(array('target_instance' => $mock)),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue