You are here

public function CoffeeTest::testCoffeeAssets in Coffee 8

Tests that the coffee assets are loaded properly.

File

tests/src/Functional/CoffeeTest.php, line 123

Class

CoffeeTest
Tests Coffee module functionality.

Namespace

Drupal\Tests\coffee\Functional

Code

public function testCoffeeAssets() {

  // Ensure that the coffee assets are not loaded for users without the
  // adequate permission.
  $this
    ->drupalGet('');
  $this
    ->assertSession()
    ->responseNotContains('coffee/js/coffee.js');

  // Ensure that the coffee assets are loaded properly for users with the
  // adequate permission.
  $this
    ->drupalLogin($this->coffeeUser);
  $this
    ->drupalGet('');
  $this
    ->assertSession()
    ->responseContains('coffee/js/coffee.js');

  // Ensure that the coffee assets are not loaded for users without the
  // adequate permission.
  $this
    ->drupalLogin($this->webUser);
  $this
    ->drupalGet('');
  $this
    ->assertSession()
    ->responseNotContains('coffee/js/coffee.js');
}