TypedNodeArticleUnitTest.php 953 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
<?php

/**
 * @file
 * Contains \Drupal\typed_entity_example\TypedEntity\Tests\TypedNodeArticleUnitTest.
 */

namespace Drupal\typed_entity_example\TypedEntity\Tests;

10
use Drupal\typed_entity_example\TypedEntity\Node\Article;
11

12
class TypedNodeArticleUnitTest extends Article {
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

  /**
   * Overrides TypedNodeArticle::t().
   *
   * Override translation method so it does not require the database.
   */
  protected static function t($string, array $args = array()) {
    return format_string($string, $args);
  }

  /**
   * Overrides TypedNodeArticle::getEntity().
   */
  public function getEntity() {
    $article = array(
      'title' => 'Foo',
      'uid' => 1,
      'status' => 1,
      'nid' => 1,
      'type' => 'article',
      'field_body' => array(
        LANGUAGE_NONE => array(
          array(
            'safe_value' => 'bar',
            'value' => 'bar',
          ),
        ),
      ),
    );
    return (object) $article;
  }

}