Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663

This commit is contained in:
Greg Anderson 2015-10-08 11:40:12 -07:00
parent eb34d130a8
commit f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions

View file

@ -20,7 +20,7 @@ class EntityResolverTest extends NormalizerTestBase {
*
* @var array
*/
public static $modules = array('entity_reference', 'hal', 'rest');
public static $modules = ['hal', 'rest'];
/**
* The format being tested.

View file

@ -39,6 +39,13 @@ class EntitySerializationTest extends NormalizerTestBase {
*/
protected $entity;
/**
* The test user.
*
* @var \Drupal\user\Entity\User
*/
protected $user;
/**
* The serializer service.
*
@ -58,10 +65,19 @@ class EntitySerializationTest extends NormalizerTestBase {
// User create needs sequence table.
$this->installSchema('system', array('sequences'));
// Create a test user to use as the entity owner.
$this->user = \Drupal::entityManager()->getStorage('user')->create([
'name' => 'serialization_test_user',
'mail' => 'foo@example.com',
'pass' => '123456',
]);
$this->user->save();
// Create a test entity to serialize.
$this->values = array(
'name' => $this->randomMachineName(),
'user_id' => \Drupal::currentUser()->id(),
'user_id' => $this->user->id(),
'field_test_text' => array(
'value' => $this->randomMachineName(),
'format' => 'full_html',
@ -99,7 +115,10 @@ class EntitySerializationTest extends NormalizerTestBase {
array('value' => $this->entity->created->value),
),
'user_id' => array(
array('target_id' => $this->values['user_id']),
array(
'target_id' => $this->user->id(),
'url' => $this->user->url(),
),
),
'revision_id' => array(
array('value' => 1),
@ -128,22 +147,15 @@ class EntitySerializationTest extends NormalizerTestBase {
* override some default access controls.
*/
public function testUserNormalize() {
$account = User::create([
'name' => 'serialization_test_user',
'mail' => 'foo@example.com',
'pass' => '123456',
]);
$account->save();
// Test password isn't available.
$normalized = $this->serializer->normalize($account);
$normalized = $this->serializer->normalize($this->user);
$this->assertFalse(array_key_exists('pass', $normalized), '"pass" key does not exist in normalized user');
$this->assertFalse(array_key_exists('mail', $normalized), '"mail" key does not exist in normalized user');
// Test again using our test user, so that our access control override will
// allow password viewing.
$normalized = $this->serializer->normalize($account, NULL, ['account' => $account]);
$normalized = $this->serializer->normalize($this->user, NULL, ['account' => $this->user]);
// The key 'pass' will now exist, but the password value should be
// normalized to NULL.
@ -179,7 +191,7 @@ class EntitySerializationTest extends NormalizerTestBase {
'name' => '<name><value>' . $this->values['name'] . '</value></name>',
'type' => '<type><value>entity_test_mulrev</value></type>',
'created' => '<created><value>' . $this->entity->created->value . '</value></created>',
'user_id' => '<user_id><target_id>' . $this->values['user_id'] . '</target_id></user_id>',
'user_id' => '<user_id><target_id>' . $this->user->id() . '</target_id><url>' . $this->user->url() . '</url></user_id>',
'revision_id' => '<revision_id><value>' . $this->entity->getRevisionId() . '</value></revision_id>',
'default_langcode' => '<default_langcode><value>1</value></default_langcode>',
'field_test_text' => '<field_test_text><value>' . $this->values['field_test_text']['value'] . '</value><format>' . $this->values['field_test_text']['format'] . '</format></field_test_text>',