Update to Drupal 8.2.2. For more information, see https://www.drupal.org/project/drupal/releases/8.2.2

This commit is contained in:
Pantheon Automation 2016-11-02 11:43:31 -07:00 committed by Greg Anderson
parent 23ffed3665
commit 507b45a0ed
378 changed files with 11434 additions and 5542 deletions

View file

@ -7,6 +7,7 @@ use Drupal\Core\TypedData\TypedDataManagerInterface;
use Drupal\Tests\UnitTestCase;
use Drupal\serialization\Normalizer\ListNormalizer;
use Drupal\Core\TypedData\Plugin\DataType\ItemList;
use Symfony\Component\Serializer\Serializer;
/**
* @coversDefaultClass \Drupal\serialization\Normalizer\ListNormalizer
@ -35,13 +36,20 @@ class ListNormalizerTest extends UnitTestCase {
*/
protected $expectedListValues = array('test', 'test', 'test');
/**
* The mocked typed data.
*
* @var \PHPUnit_Framework_MockObject_MockObject|\Drupal\Core\TypedData\TypedDataInterface
*/
protected $typedData;
protected function setUp() {
// Mock the TypedDataManager to return a TypedDataInterface mock.
$typed_data = $this->getMock('Drupal\Core\TypedData\TypedDataInterface');
$this->typedData = $this->getMock('Drupal\Core\TypedData\TypedDataInterface');
$typed_data_manager = $this->getMock(TypedDataManagerInterface::class);
$typed_data_manager->expects($this->any())
->method('getPropertyInstance')
->will($this->returnValue($typed_data));
->will($this->returnValue($this->typedData));
// Set up a mock container as ItemList() will call for the 'typed_data_manager'
// service.
@ -73,16 +81,14 @@ class ListNormalizerTest extends UnitTestCase {
* Tests the normalize() method.
*/
public function testNormalize() {
$serializer = $this->getMockBuilder('Symfony\Component\Serializer\Serializer')
->setMethods(array('normalize'))
->getMock();
$serializer->expects($this->exactly(3))
->method('normalize')
->will($this->returnValue('test'));
$serializer = $this->prophesize(Serializer::class);
$serializer->normalize($this->typedData, 'json', ['mu' => 'nu'])
->shouldBeCalledTimes(3)
->willReturn('test');
$this->normalizer->setSerializer($serializer);
$this->normalizer->setSerializer($serializer->reveal());
$normalized = $this->normalizer->normalize($this->list);
$normalized = $this->normalizer->normalize($this->list, 'json', ['mu' => 'nu']);
$this->assertEquals($this->expectedListValues, $normalized);
}