View source
<?php
namespace Drupal\Tests\ga\Unit\AnalyticsCommand\Linker;
use Drupal\ga\AnalyticsCommand\Linker\AutoLink;
use Drupal\Tests\UnitTestCase;
class AutoLinkTest extends UnitTestCase {
public function testDefaultPriority() {
$command = new AutoLink([
'example.com',
]);
$this
->assertEquals(0, $command
->getPriority());
}
public function testBasicSettingCommands() {
$command = new AutoLink([
'one.example.com',
'two.example.com',
]);
$this
->assertEquals([
[
'linker:autoLink',
[
'one.example.com',
'two.example.com',
],
],
], $command
->getSettingCommands());
}
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());
}
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());
}
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());
}
}