-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from SU-SWS/tests
added functional tests
- Loading branch information
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|
||
} |