1

What I can't workout is what steps I need to see if the entity is loaded using simple test. Any direction will be greatly appreciated thanks.

/**
 * @file
 * Definition of creation of a entity.
 */

/**
 * Coded entity display test.
 */
class CreateCoded extends DrupalWebTestCase {

  /**
   * Implements getInfo().
   */
  public static function getInfo() {
    return array(
      'name' => 'Coded',
      'description' => 'Adding table to entities to create entity',
      'group' => 'Coded',
    );
  }

  /**
   * Enables modules that are need for test.
   */
  public function setUp() {
    // Enable any module that you will need in your tests.
    parent::setUp('coded');
  }

  /**
   * Tests for table coded. 
   * 
   * @Description
   *   Method needs to start with test if you wnat to test.
   */
  public function testCreateCodedEntity() {
    // how to I test the entity

  }
}

2

Try the examples module:

This project aims to provide high-quality, well-documented API examples for a broad range of Drupal core functionality.

The Examples project contains many modules which hopefully illustrate best practices for implementing various Drupal APIs. These modules can be enabled individually, and will typically add menu items to your site, which should guide you through their features. You can then look through the code to see what they are doing.

It has a drupal 7 & 8 entity example in which has a test as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.