commit 37dcafdcb664cbd14190609768845122acf1e3b1 Author: Joel Pittet Date: Mon Jan 11 11:54:38 2016 -0800 remove template suggest diff --git a/core/modules/system/src/Tests/Entity/EntityTemplateSuggestionsTest.php b/core/modules/system/src/Tests/Entity/EntityTemplateSuggestionsTest.php deleted file mode 100644 index d11ec25..0000000 --- a/core/modules/system/src/Tests/Entity/EntityTemplateSuggestionsTest.php +++ /dev/null @@ -1,98 +0,0 @@ -entity_name = $this->randomMachineName(); - $this->entity_user = $this->createUser(); - - // Pass in the value of the name field when creating. With the user - // field we test setting a field after creation. - $entity = entity_create($entity_type); - $entity->user_id->target_id = $this->entity_user->id(); - $entity->name->value = $this->entity_name; - - return $entity; - } - - /** - * Tests generation of template suggestions based on entity properties. - */ - public function testReadWrite() { - - // All entity variations have to have the same results. - foreach (entity_test_entity_types() as $entity_type) { - $this->assertTemplateSuggestions($entity_type); - } - } - - /** - * Executes the template suggestions test set for a defined entity type. - * - * @param string $entity_type - * The entity type to run the tests with. - */ - protected function assertTemplateSuggestions($entity_type) { - $entity = $this->createTestEntity($entity_type); - - $entity_definition = \Drupal::entityManager()->getDefinition($entity_type, FALSE); - - if ($entity_definition->hasViewBuilderClass()) { - $view_modes = \Drupal::entityManager()->getFormModes($entity_type); - - foreach ($view_modes as $id => $view_mode) { - - if ($view_builder = \Drupal::entityManager()->getViewBuilder($entity_type)) { - $entity_id = rand(1, 20); - $sanitized_view_mode = strtr($id, '.', '_'); - $bundle_name = $entity->bundle(); - $entity->{$entity_definition->getKey('id')} = $entity_id; - - $suggestions = $view_builder->getTemplateSuggestions($entity, $id); - - $expected = array( - $entity_type . '__' . $sanitized_view_mode, - $entity_type . '__' . $bundle_name, - $entity_type . '__' . $bundle_name . '__' . $sanitized_view_mode, - $entity_type . '__' . $entity_id, - $entity_type . '__' . $entity_id . '__' . $sanitized_view_mode, - ); - - $this->assertEqual($expected, $suggestions, json_encode($suggestions)); - } - } - } - } - -}