diff --git a/src/DefaultContentServiceProvider.php b/src/DefaultContentServiceProvider.php index a270f1a..28133b0 100644 --- a/src/DefaultContentServiceProvider.php +++ b/src/DefaultContentServiceProvider.php @@ -30,6 +30,7 @@ class DefaultContentServiceProvider extends ServiceProviderBase { ->setClass('Drupal\default_content\LinkManager\RelationLinkManager'); $modules = $container->getParameter('container.modules'); + // @todo Get rid of after https://www.drupal.org/node/2543726 if (isset($modules['taxonomy'])) { // Add a normalizer service for term entities. $service_definition = new Definition('Drupal\default_content\Normalizer\TermEntityNormalizer', [ diff --git a/src/Tests/DefaultContentManagerIntegrationTest.php b/src/Tests/DefaultContentManagerIntegrationTest.php index c555519..b165669 100644 --- a/src/Tests/DefaultContentManagerIntegrationTest.php +++ b/src/Tests/DefaultContentManagerIntegrationTest.php @@ -7,6 +7,7 @@ namespace Drupal\default_content\Tests; +use Drupal\Core\Url; use Drupal\default_content\DefaultContentManager; use Drupal\node\Entity\Node; use Drupal\node\Entity\NodeType; @@ -67,6 +68,21 @@ class DefaultContentManagerIntegrationTest extends KernelTestBase { // Ensure the proper UUID is part of it. $this->assertEqual($exported_decoded->uuid[0]->value, $term->uuid()); $this->assertEqual($exported, $expected); + + // Tests export of taxonomy parent field. + // @todo Get rid of after https://www.drupal.org/node/2543726 + $child_term = $term = Term::create([ + 'vid' => $vocabulary->id(), + 'name' => 'child_name', + 'parent' => $term->id(), + ]); + $child_term->save(); + // Make sure parent relation is exported. + $exported = $this->defaultContentManager->exportContent('taxonomy_term', $child_term->id()); + $relation_uri = 'http://drupal.org/rest/relation/taxonomy_term/test/parent'; + $exported_decoded = json_decode($exported); + $this->assertFalse(empty($exported_decoded->_links->{$relation_uri})); + $this->assertFalse(empty($exported_decoded->_embedded->{$relation_uri})); } /**