Projet

Général

Profil

Révision d50a36e0

Ajouté par Assos Assos il y a presque 4 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/fivestar/test/fivestar.base.test
1 1
<?php
2

  
2 3
/**
3 4
 * @file
4
 * Based test file for the Fivestar module.
5
 * Test base for the Fivestar module.
5 6
 */
6 7

  
8
/**
9
 * Base class for Fivestar Ajax tests.
10
 */
7 11
class FivestarBaseTestCase extends AJAXTestCase {
8
  // Using testing profile.
9
  // @see http://groups.drupal.org/node/217189
12

  
13
  /**
14
   * Use testing profile.
15
   *
16
   * @see http://groups.drupal.org/node/217189
17
   */
10 18
  protected $profile = 'testing';
11 19

  
12
  // Set up our basic users.
13
  protected $admin_user;
14
  protected $voter;
15
  
20
  /**
21
   * A user with permission to administer Fivestar.
22
   */
23
  protected $adminUser;
24

  
25
  /**
26
   * A user with permission to vote.
27
   */
28
  protected $voterUser;
29

  
30
  /**
31
   * {@inheritdoc}
32
   */
16 33
  public function setUp() {
17 34
    parent::setUp(array('fivestar', 'dblog'));
18 35

  
19 36
    $type = $this->drupalCreateContentType(array('type' => 'test_node_type', 'name' => 'test_node_type'));
20
    $this->admin_user = $this->drupalCreateUser(array('create test_node_type content', 'rate content'));
21
    $this->voter_user = $this->drupalCreateUser(array('rate content'));
22
 }
37
    $this->adminUser = $this->drupalCreateUser(array('create test_node_type content', 'rate content'));
38
    $this->voterUser = $this->drupalCreateUser(array('rate content'));
39
  }
23 40

  
24 41
  /**
25 42
   * Add a fivestar field to a content type.
26 43
   *
27
   * @param $options
44
   * @param array $options
28 45
   *   An associative array of options for the field and instance.
29 46
   */
30
  public function createFivestarField($options = array()) {
47
  public function createFivestarField(array $options = array()) {
31 48
    $options = $options + array(
32 49
      'content_type' => 'test_node_type',
33 50
      'widget_type' => 'stars',
......
64 81
    field_create_field($field);
65 82
    field_create_instance($instance);
66 83
  }
84

  
67 85
}

Formats disponibles : Unified diff