You are here

public function FivestarTestCase::testViewerNonRating in Fivestar 7.2

Test exposed display setting.

Tests that users can not rate content with exposed widgets that have their exposed display setting set to FALSE.

File

test/fivestar.field.test, line 101
Simpletests for the Fivestar module.

Class

FivestarTestCase
Makes sure fivestar widgets can be created and used.

Code

public function testViewerNonRating() {

  // Add an exposed field, with the Exposed display settings set to FALSE.
  $this
    ->createFivestarField(array(
    'widget_type' => 'exposed',
    'display' => array(
      'default' => array(
        'type' => 'fivestar_formatter_default',
        'settings' => array(
          'style' => 'average',
          'text' => 'average',
          'expose' => FALSE,
        ),
      ),
    ),
  ));

  // Add a test_node_type to test static widget.
  $node = $this
    ->drupalCreateNode(array(
    'type' => 'test_node_type',
  ));

  // Rate the test_node_type.
  $this
    ->drupalLogin($this->voterUser);
  $this
    ->drupalGet('node/' . $node->nid);
  $this
    ->assertRaw('No votes yet', 'Fivestar field has no votes.');
  $this
    ->assertFalse($this
    ->xpath("//form[contains(@class, 'fivestar-widget')]"));
}