class LinkCheckerResponseCodesTest in Link checker 8
Tests \Drupal\linkchecker\LinkCheckerResponseCodes.
@group linkchecker
@coversDefaultClass \Drupal\linkchecker\LinkCheckerResponseCodes
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses PhpunitCompatibilityTrait
- class \Drupal\Tests\linkchecker\Unit\LinkCheckerResponseCodesTest
Expanded class hierarchy of LinkCheckerResponseCodesTest
File
- tests/
src/ Unit/ LinkCheckerResponseCodesTest.php, line 15
Namespace
Drupal\Tests\linkchecker\UnitView source
class LinkCheckerResponseCodesTest extends UnitTestCase {
/**
* The linkchecker response codes service.
*
* @var \Drupal\linkchecker\LinkCheckerResponseCodes
*/
protected $linkCheckerResponseCodes;
/**
* {@inheritdoc}
*/
public function setUp() {
parent::setUp();
$this->linkCheckerResponseCodes = new LinkCheckerResponseCodes();
}
/**
* Tests the the ::isValid method.
*
* @param int $code
* The HTTP response code.
* @param bool $result
* The expected result from calling the function.
*
* @dataProvider isValidDataProvider
*
* @covers ::isValid
*/
public function testIsValid(int $code, bool $result) {
$this
->assertEquals($result, $this->linkCheckerResponseCodes
->isValid($code));
}
/**
* Data provider for testIsValid().
*
* @see testIsValid()
*/
public function isValidDataProvider() {
return [
[
100,
TRUE,
],
[
101,
TRUE,
],
[
102,
FALSE,
],
[
103,
FALSE,
],
[
200,
TRUE,
],
[
201,
TRUE,
],
[
202,
TRUE,
],
[
203,
TRUE,
],
[
204,
TRUE,
],
[
205,
TRUE,
],
[
206,
TRUE,
],
[
207,
FALSE,
],
[
208,
FALSE,
],
[
226,
FALSE,
],
[
300,
TRUE,
],
[
301,
TRUE,
],
[
302,
TRUE,
],
[
303,
TRUE,
],
[
304,
TRUE,
],
[
305,
TRUE,
],
[
306,
FALSE,
],
[
307,
TRUE,
],
[
308,
FALSE,
],
[
400,
TRUE,
],
[
401,
TRUE,
],
[
402,
TRUE,
],
[
403,
TRUE,
],
[
404,
TRUE,
],
[
405,
TRUE,
],
[
406,
TRUE,
],
[
407,
TRUE,
],
[
408,
TRUE,
],
[
409,
TRUE,
],
[
410,
TRUE,
],
[
411,
TRUE,
],
[
412,
TRUE,
],
[
413,
TRUE,
],
[
414,
TRUE,
],
[
415,
TRUE,
],
[
416,
TRUE,
],
[
417,
TRUE,
],
[
418,
FALSE,
],
[
421,
FALSE,
],
[
422,
FALSE,
],
[
423,
FALSE,
],
[
424,
FALSE,
],
[
425,
FALSE,
],
[
426,
FALSE,
],
[
428,
FALSE,
],
[
429,
FALSE,
],
[
431,
FALSE,
],
[
451,
FALSE,
],
[
500,
TRUE,
],
[
501,
TRUE,
],
[
502,
TRUE,
],
[
503,
TRUE,
],
[
504,
TRUE,
],
[
505,
TRUE,
],
[
506,
FALSE,
],
[
507,
FALSE,
],
[
508,
FALSE,
],
[
510,
FALSE,
],
[
511,
FALSE,
],
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LinkCheckerResponseCodesTest:: |
protected | property | The linkchecker response codes service. | |
LinkCheckerResponseCodesTest:: |
public | function | Data provider for testIsValid(). | |
LinkCheckerResponseCodesTest:: |
public | function |
Overrides UnitTestCase:: |
|
LinkCheckerResponseCodesTest:: |
public | function | Tests the the ::isValid method. | |
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. |