View source
<?php
namespace Drupal\Tests\ga\Unit\AnalyticsCommand;
use Drupal\ga\AnalyticsCommand\Set;
use Drupal\Tests\UnitTestCase;
class SetTest extends UnitTestCase {
public function testDefaultPriority() {
$command = new Set('key', 'value');
$this
->assertEquals(100, $command
->getPriority());
}
public function testBasicSettingCommands() {
$command = new Set('key', 'value');
$this
->assertEquals([
[
'set',
'key',
'value',
],
], $command
->getSettingCommands());
}
public function testWithFieldsObjectSettingCommmands() {
$command = new Set('key', 'value', [
'field1' => 'value1',
]);
$this
->assertEquals([
[
'set',
'key',
'value',
[
'field1' => 'value1',
],
],
], $command
->getSettingCommands());
}
public function testWithTrackerNameSettingCommands() {
$command = new Set('key', 'value', [], 'tracker');
$this
->assertEquals([
[
'tracker.set',
'key',
'value',
],
], $command
->getSettingCommands());
}
}