class AutoLinkTest in Googalytics - Google Analytics 8
@coversDefaultClass \Drupal\ga\AnalyticsCommand\Linker\AutoLink @group ga
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses PhpunitCompatibilityTrait
- class \Drupal\Tests\ga\Unit\AnalyticsCommand\Linker\AutoLinkTest
Expanded class hierarchy of AutoLinkTest
File
- tests/
src/ Unit/ AnalyticsCommand/ Linker/ AutoLinkTest.php, line 12
Namespace
Drupal\Tests\ga\Unit\AnalyticsCommand\LinkerView source
class AutoLinkTest extends UnitTestCase {
/**
* Test the default priority.
*/
public function testDefaultPriority() {
$command = new AutoLink([
'example.com',
]);
$this
->assertEquals(0, $command
->getPriority());
}
/**
* Test the command array for a basic command without additional options.
*/
public function testBasicSettingCommands() {
$command = new AutoLink([
'one.example.com',
'two.example.com',
]);
$this
->assertEquals([
[
'linker:autoLink',
[
'one.example.com',
'two.example.com',
],
],
], $command
->getSettingCommands());
}
/**
* Test the command when the useAnchor parameter is provided.
*/
public function testWithAnchor() {
$command = new AutoLink([
'one.example.com',
'two.example.com',
], TRUE);
$this
->assertEquals([
[
'linker:autoLink',
[
'one.example.com',
'two.example.com',
],
TRUE,
],
], $command
->getSettingCommands());
}
/**
* Test the command when useAnchor and decorateForms parameters are provided.
*/
public function testWithAnchorAndForm() {
$command = new AutoLink([
'one.example.com',
'two.example.com',
], TRUE, TRUE);
$this
->assertEquals([
[
'linker:autoLink',
[
'one.example.com',
'two.example.com',
],
TRUE,
TRUE,
],
], $command
->getSettingCommands());
}
/**
* Test the command when only decorateForms parameter is provided.
*/
public function testWithForm() {
$command = new AutoLink([
'one.example.com',
'two.example.com',
], NULL, TRUE);
$this
->assertEquals([
[
'linker:autoLink',
[
'one.example.com',
'two.example.com',
],
FALSE,
TRUE,
],
], $command
->getSettingCommands());
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AutoLinkTest:: |
public | function | Test the command array for a basic command without additional options. | |
AutoLinkTest:: |
public | function | Test the default priority. | |
AutoLinkTest:: |
public | function | Test the command when the useAnchor parameter is provided. | |
AutoLinkTest:: |
public | function | Test the command when useAnchor and decorateForms parameters are provided. | |
AutoLinkTest:: |
public | function | Test the command when only decorateForms parameter is provided. | |
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. | |
UnitTestCase:: |
protected | function | 340 |