You are here

protected function FileNormalizeTest::setUp in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/hal/src/Tests/FileNormalizeTest.php \Drupal\hal\Tests\FileNormalizeTest::setUp()

Performs setup tasks before each individual test method is run.

Overrides NormalizerTestBase::setUp

File

core/modules/hal/src/Tests/FileNormalizeTest.php, line 37
Contains \Drupal\hal\Tests\FileNormalizeTest.

Class

FileNormalizeTest
Tests that file entities can be normalized in HAL.

Namespace

Drupal\hal\Tests

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installEntitySchema('file');
  $entity_manager = \Drupal::entityManager();
  $link_manager = new LinkManager(new TypeLinkManager(new MemoryBackend('default'), \Drupal::moduleHandler(), \Drupal::service('config.factory'), \Drupal::service('request_stack')), new RelationLinkManager(new MemoryBackend('default'), $entity_manager, \Drupal::moduleHandler(), \Drupal::service('config.factory'), \Drupal::service('request_stack')));

  // Set up the mock serializer.
  $normalizers = array(
    new FieldItemNormalizer(),
    new FileEntityNormalizer($entity_manager, \Drupal::httpClient(), $link_manager, \Drupal::moduleHandler()),
  );
  $encoders = array(
    new JsonEncoder(),
  );
  $this->serializer = new Serializer($normalizers, $encoders);
}