This repository was archived by the owner on Dec 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathLeLoggerTests.php
More file actions
108 lines (77 loc) · 3.01 KB
/
LeLoggerTests.php
File metadata and controls
108 lines (77 loc) · 3.01 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php
class LeLoggerTest extends PHPUnit_Framework_TestCase
{
/**
* @expectedException PHPUnit_Framework_Error_Warning
*/
public function testOneParameter()
{
$this->assertNotInstanceOf('LeLogger.php', LeLogger::getLogger('token'));
}
/**
* @expectedException PHPUnit_Framework_Error_Warning
*/
public function testTwoParameter()
{
$this->assertNotInstanceOf('LeLogger', LeLogger::getLogger('token', false));
}
/**
* @expectedException PHPUnit_Framework_Error_Warning
*/
public function testThreeParameter()
{
$this->assertNotInstanceOf('LeLogger', LeLogger::getLogger('token', false, false));
}
public function testAllParameters()
{
$this->assertInstanceOf('LeLogger', LeLogger::getLogger('token', false, false, LOG_DEBUG, false, "", 10000, "", "", false, true));
}
public function testMultiplyConnections()
{
$logFirst = LeLogger::getLogger('token1', false, false, LOG_DEBUG, false, "", 10000, "", "", false, true);
$logSecond = LeLogger::getLogger('token2', false, false, LOG_DEBUG, false, "", 10000, "", "", false, true);
$logThird = LeLogger::getLogger('token3', false, false, LOG_DEBUG, false, "", 10000, "", "", false, true);
$this->assertNotEquals('token1', $logSecond->getToken());
$this->assertNotEquals('token2', $logThird->getToken());
$this->assertEquals('token1', $logFirst->getToken());
$this->assertEquals('token2', $logSecond->getToken());
$this->assertEquals('token3', $logThird->getToken());
}
public function testIsPersistent()
{
$log = LeLogger::getLogger('token', false, true, LOG_DEBUG, false, "", 10000, "", "", false, true);
$this->assertFalse($log->isPersistent());
$this->tearDown();
$log = LeLogger::getLogger('token', true, true, LOG_DEBUG, false, "", 10000, "", "", false, true);
$this->assertTrue($log->isPersistent());
}
public function testIsTLS()
{
$log = LeLogger::getLogger('token',false,false, LOG_DEBUG, false, "", 10000, "", "", false, true);
$this->assertFalse($log->isTLS());
$this->tearDown();
$log = LeLogger::getLogger('token', true, true, LOG_DEBUG, false, "", 10000, "", "", false, true);
$this->assertTrue($log->isTLS());
}
public function testGetPort()
{
$log = LeLogger::getLogger('token', true, false, LOG_DEBUG, false, "", 10000, "", "", false, true);
$this->assertEquals(10000, $log->getPort());
$this->tearDown();
$log = LeLogger::getLogger('token', true, true, LOG_DEBUG, false, "", 0, "", "", false, true);
$this->assertEquals(20000, $log->getPort());
}
public function testGetAddress()
{
$log = LeLogger::getLogger('token', true, false, LOG_DEBUG, false, "", 10000, "", "", false, true);
$this->assertEquals('tcp://data.logentries.com', $log->getAddress());
$this->tearDown();
$log = LeLogger::getLogger('token', true, true, LOG_DEBUG, false, "", 10000, "", "", false, true);
$this->assertEquals('tls://api.logentries.com', $log->getAddress());
}
public function tearDown()
{
LeLogger::tearDown();
}
}
?>