class UnpublishedNodesRedirectTest in Unpublished Nodes Redirect 8
Same name and namespace in other branches
- 2.x tests/src/Unit/UnpublishedNodesRedirectTest.php \Drupal\Tests\unpublished_nodes_redirect\Unit\UnpublishedNodesRedirectTest
Test for Unpublished nodes redirect module.
@group unpublished_nodes_redirect
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses PhpunitCompatibilityTrait
- class \Drupal\Tests\unpublished_nodes_redirect\Unit\UnpublishedNodesRedirectTest
Expanded class hierarchy of UnpublishedNodesRedirectTest
File
- tests/
src/ Unit/ UnpublishedNodesRedirectTest.php, line 13
Namespace
Drupal\Tests\unpublished_nodes_redirect\UnitView source
class UnpublishedNodesRedirectTest extends UnitTestCase {
/**
*
*/
protected function setUp() {
$this->utils = new Utils();
parent::setUp();
}
/**
* Tests getting node type keys.
*/
public function testGetNodeTypeKey() {
$this
->assertEquals('content_type_name_unpublished_redirect_path', $this->utils
->getNodeTypeKey('content_type_name'));
}
/**
* Tests getting response code keys.
*/
public function testGetResponseCodeKey() {
$this
->assertEquals('content_type_name_unpublished_redirect_response_code', $this->utils
->getResponseCodeKey('content_type_name'));
}
/**
* Tests checks before redirect.
*/
public function testChecksBeforeRedirect() {
$this
->assertTrue(TRUE, $this->utils
->checksBeforeRedirect(0, TRUE, '', 'test/path', 301));
$this
->assertFalse(FALSE, $this->utils
->checksBeforeRedirect(1, TRUE, '', 'test/path', 301));
$this
->assertFalse(FALSE, $this->utils
->checksBeforeRedirect(0, FALSE, '', 'test/path', 301));
$this
->assertFalse(FALSE, $this->utils
->checksBeforeRedirect(0, FALSE, '', '', 301));
$this
->assertFalse(FALSE, $this->utils
->checksBeforeRedirect(0, FALSE, '', 'test/path', 0));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PhpunitCompatibilityTrait:: |
public | function | Returns a mock object for the specified class using the available method. | |
PhpunitCompatibilityTrait:: |
public | function | Compatibility layer for PHPUnit 6 to support PHPUnit 4 code. | |
UnitTestCase:: |
protected | property | The random generator. | |
UnitTestCase:: |
protected | property | The app root. | 1 |
UnitTestCase:: |
protected | function | Asserts if two arrays are equal by sorting them first. | |
UnitTestCase:: |
protected | function | Mocks a block with a block plugin. | 1 |
UnitTestCase:: |
protected | function | Returns a stub class resolver. | |
UnitTestCase:: |
public | function | Returns a stub config factory that behaves according to the passed array. | |
UnitTestCase:: |
public | function | Returns a stub config storage that returns the supplied configuration. | |
UnitTestCase:: |
protected | function | Sets up a container with a cache tags invalidator. | |
UnitTestCase:: |
protected | function | Gets the random generator for the utility methods. | |
UnitTestCase:: |
public | function | Returns a stub translation manager that just returns the passed string. | |
UnitTestCase:: |
public | function | Generates a unique random string containing letters and numbers. | |
UnpublishedNodesRedirectTest:: |
protected | function |
Overrides UnitTestCase:: |
|
UnpublishedNodesRedirectTest:: |
public | function | Tests checks before redirect. | |
UnpublishedNodesRedirectTest:: |
public | function | Tests getting node type keys. | |
UnpublishedNodesRedirectTest:: |
public | function | Tests getting response code keys. |