Skip to content

Commit

Permalink
Merge pull request #6 from SU-SWS/tests
Browse files Browse the repository at this point in the history
added functional tests
  • Loading branch information
sherakama authored Aug 7, 2018
2 parents 484c7ad + eab2236 commit bd7d9ae
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/src/Functional/NobotsDisabledTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace Drupal\Tests\nobots\Functional;

use Drupal\Tests\BrowserTestBase;

/**
* Test nobots header when disabled.
*
* @package Drupal\Tests\nobots\Unit
* @group nobots
*/
class NobotsDisabledTest extends BrowserTestBase {

/**
* Modules to enable.
*
* @var array
*/
public static $modules = ['system'];

/**
* Test that the header does not exist.
*/
public function testNobots() {
$this->drupalGet('<front>');
$header = $this->getSession()->getResponseHeader('x-robots-tag');
$this->assertEquals('', $header);
}

}
31 changes: 31 additions & 0 deletions tests/src/Functional/NobotsEnabledTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace Drupal\Tests\nobots\Functional;

use Drupal\Tests\BrowserTestBase;

/**
* Test nobots header when enabled..
*
* @package Drupal\Tests\nobots\Unit
* @group nobots
*/
class NobotsEnabledTest extends BrowserTestBase {

/**
* Modules to enable.
*
* @var array
*/
public static $modules = ['system', 'nobots'];

/**
* Test that the header exists and is correct.
*/
public function testNobots() {
$this->drupalGet('<front>');
$header = $this->getSession()->getResponseHeader('x-robots-tag');
$this->assertEquals('noindex,nofollow,noarchive', $header);
}

}

0 comments on commit bd7d9ae

Please sign in to comment.