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