View source
<?php
namespace Drupal\Tests\ga\Unit\AnalyticsCommand;
use Drupal\ga\AnalyticsCommand\Create;
use Drupal\Tests\UnitTestCase;
class CreateTest extends UnitTestCase {
public function testDefaultPriority() {
$command = new Create('UA-12345678-1');
$this
->assertEquals(300, $command
->getPriority());
}
public function testBasicSettingCommands() {
$command = new Create('UA-12345678-1');
$this
->assertEquals([
[
'create',
'UA-12345678-1',
'auto',
],
], $command
->getSettingCommands());
}
public function testCookieDomainSettingCommand() {
$command = new Create('UA-12345678-1', '.example.com');
$this
->assertEquals([
[
'create',
'UA-12345678-1',
'.example.com',
],
], $command
->getSettingCommands());
}
public function testWithFieldsObjectSettingCommmands() {
$command = new Create('UA-12345678-1', 'auto', NULL, [
'field1' => 'value1',
]);
$this
->assertEquals([
[
'create',
'UA-12345678-1',
'auto',
[
'field1' => 'value1',
],
],
], $command
->getSettingCommands());
}
public function testWithTrackerNameSettingCommands() {
$command = new Create('UA-12345678-1', 'auto', 'tracker', []);
$this
->assertEquals([
[
'create',
'UA-12345678-1',
'auto',
'tracker',
],
], $command
->getSettingCommands());
}
}