-
Notifications
You must be signed in to change notification settings - Fork 127
Expand file tree
/
Copy pathSegmentTest.php
More file actions
78 lines (64 loc) · 2.53 KB
/
Copy pathSegmentTest.php
File metadata and controls
78 lines (64 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
declare(strict_types=1);
namespace Segment\Test;
use PHPUnit\Framework;
use Segment\Segment;
use Segment\SegmentException;
final class SegmentTest extends Framework\TestCase
{
protected function setUp(): void
{
self::resetSegment();
}
public function testAliasThrowsSegmentExceptionWhenClientHasNotBeenInitialized(): void
{
$this->expectException(SegmentException::class);
$this->expectExceptionMessage('Segment::init() must be called before any other tracking method.');
Segment::alias([]);
}
public function testFlushThrowsSegmentExceptionWhenClientHasNotBeenInitialized(): void
{
$this->expectException(SegmentException::class);
$this->expectExceptionMessage('Segment::init() must be called before any other tracking method.');
Segment::flush();
}
public function testGroupThrowsSegmentExceptionWhenClientHasNotBeenInitialized(): void
{
$this->expectException(SegmentException::class);
$this->expectExceptionMessage('Segment::init() must be called before any other tracking method.');
Segment::group([]);
}
public function testIdentifyThrowsSegmentExceptionWhenClientHasNotBeenInitialized(): void
{
$this->expectException(SegmentException::class);
$this->expectExceptionMessage('Segment::init() must be called before any other tracking method.');
Segment::identify([]);
}
public function testPageThrowsSegmentExceptionWhenClientHasNotBeenInitialized(): void
{
$this->expectException(SegmentException::class);
$this->expectExceptionMessage('Segment::init() must be called before any other tracking method.');
Segment::page([]);
}
public function testScreenThrowsSegmentExceptionWhenClientHasNotBeenInitialized(): void
{
$this->expectException(SegmentException::class);
$this->expectExceptionMessage('Segment::init() must be called before any other tracking method.');
Segment::screen([]);
}
public function testTrackThrowsSegmentExceptionWhenClientHasNotBeenInitialized(): void
{
$this->expectException(SegmentException::class);
$this->expectExceptionMessage('Segment::init() must be called before any other tracking method.');
Segment::track([]);
}
private static function resetSegment(): void
{
$property = new \ReflectionProperty(
Segment::class,
'client'
);
$property->setAccessible(true);
$property->setValue(null);
}
}