SendTest.php in Googalytics - Google Analytics 8
File
tests/src/Unit/AnalyticsCommand/SendTest.php
View source
<?php
namespace Drupal\Tests\ga\Unit\AnalyticsCommand;
use Drupal\ga\AnalyticsCommand\Send;
use Drupal\Tests\UnitTestCase;
class SendTest extends UnitTestCase {
public function testDefaultPriority() {
$command = new Send('pageview');
$this
->assertEquals(-10, $command
->getPriority());
}
public function testBasicSettingCommands() {
$command = new Send('pageview');
$this
->assertEquals([
[
'send',
'pageview',
],
], $command
->getSettingCommands());
}
public function testInvalidHitType() {
$command = new Send('badtype');
}
public function testWithFieldsObjectSettingCommmands() {
$command = new Send('pageview', [
'field1' => 'value1',
]);
$this
->assertEquals([
[
'send',
'pageview',
[
'field1' => 'value1',
],
],
], $command
->getSettingCommands());
}
public function testWithTrackerNameSettingCommands() {
$command = new Send('pageview', [], 'tracker');
$this
->assertEquals([
[
'tracker.send',
'pageview',
],
], $command
->getSettingCommands());
}
}