This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
1 | <?php |
||||
2 | |||||
3 | namespace Dasao\SentryLoggerTest\Log; |
||||
4 | |||||
5 | use Dasao\SentryLogger\Log\SentryLogger; |
||||
6 | use PHPUnit\Framework\TestCase; |
||||
7 | use PHPUnit_Framework_MockObject_MockObject; |
||||
8 | use Raven_Client as SentryClient; |
||||
9 | |||||
10 | /** |
||||
11 | * Class SentryLoggerTest |
||||
12 | * |
||||
13 | * PHP Version 7 |
||||
14 | * |
||||
15 | * @category PHP |
||||
16 | * @package Dasao\SentryLoggerTest\Log |
||||
17 | * @author Dasao <[email protected]> |
||||
18 | * @copyright 2014-2017 Dasao |
||||
19 | * @license Proprietary http://www.das-ao.com |
||||
20 | */ |
||||
21 | class SentryLoggerTest extends TestCase |
||||
22 | { |
||||
23 | /** @var SentryLogger */ |
||||
24 | protected $sentryLogger; |
||||
25 | |||||
26 | /** @var SentryClient|PHPUnit_Framework_MockObject_MockObject */ |
||||
27 | protected $sentryClient; |
||||
28 | |||||
29 | /** |
||||
30 | * @return void |
||||
31 | */ |
||||
32 | public function setUp() |
||||
33 | { |
||||
34 | $this->sentryClient = $this->createMock(SentryClient::class); |
||||
35 | |||||
36 | $this->sentryLogger = new SentryLogger($this->sentryClient); |
||||
37 | } |
||||
38 | |||||
39 | /** |
||||
40 | * @return void |
||||
41 | */ |
||||
42 | View Code Duplication | public function testAlert() |
|||
0 ignored issues
–
show
|
|||||
43 | { |
||||
44 | $message = 'This is a alert'; |
||||
45 | $context = [ |
||||
46 | 'key' => 'value', |
||||
47 | ]; |
||||
48 | $this->sentryClient->expects($this->once())->method('captureMessage')->with($message, [ |
||||
0 ignored issues
–
show
$message of type string is incompatible with the type array expected by parameter $arguments of PHPUnit_Framework_MockOb...nvocationMocker::with() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
49 | 'extra' => $context, |
||||
50 | 'level' => 'error', |
||||
51 | ]); |
||||
52 | |||||
53 | $this->sentryLogger->alert($message, $context); |
||||
54 | } |
||||
55 | |||||
56 | /** |
||||
57 | * @return void |
||||
58 | */ |
||||
59 | View Code Duplication | public function testCritical() |
|||
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||||
60 | { |
||||
61 | $message = 'This is a alert'; |
||||
62 | $context = [ |
||||
63 | 'key' => 'value', |
||||
64 | ]; |
||||
65 | $this->sentryClient->expects($this->once())->method('captureMessage')->with($message, [ |
||||
0 ignored issues
–
show
$message of type string is incompatible with the type array expected by parameter $arguments of PHPUnit_Framework_MockOb...nvocationMocker::with() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
66 | 'extra' => $context, |
||||
67 | 'level' => 'fatal', |
||||
68 | ]); |
||||
69 | |||||
70 | $this->sentryLogger->critical($message, $context); |
||||
71 | } |
||||
72 | |||||
73 | /** |
||||
74 | * @return void |
||||
75 | */ |
||||
76 | View Code Duplication | public function testDebug() |
|||
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||||
77 | { |
||||
78 | $message = 'This is a alert'; |
||||
79 | $context = [ |
||||
80 | 'key' => 'value', |
||||
81 | ]; |
||||
82 | $this->sentryClient->expects($this->once())->method('captureMessage')->with($message, [ |
||||
0 ignored issues
–
show
$message of type string is incompatible with the type array expected by parameter $arguments of PHPUnit_Framework_MockOb...nvocationMocker::with() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
83 | 'extra' => $context, |
||||
84 | 'level' => 'debug', |
||||
85 | ]); |
||||
86 | |||||
87 | $this->sentryLogger->debug($message, $context); |
||||
88 | } |
||||
89 | |||||
90 | /** |
||||
91 | * @return void |
||||
92 | */ |
||||
93 | View Code Duplication | public function testEmergency() |
|||
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||||
94 | { |
||||
95 | $message = 'This is a alert'; |
||||
96 | $context = [ |
||||
97 | 'key' => 'value', |
||||
98 | ]; |
||||
99 | $this->sentryClient->expects($this->once())->method('captureMessage')->with($message, [ |
||||
0 ignored issues
–
show
$message of type string is incompatible with the type array expected by parameter $arguments of PHPUnit_Framework_MockOb...nvocationMocker::with() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
100 | 'extra' => $context, |
||||
101 | 'level' => 'fatal', |
||||
102 | ]); |
||||
103 | |||||
104 | $this->sentryLogger->emergency($message, $context); |
||||
105 | } |
||||
106 | |||||
107 | /** |
||||
108 | * @return void |
||||
109 | */ |
||||
110 | View Code Duplication | public function testInfo() |
|||
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||||
111 | { |
||||
112 | $message = 'This is a alert'; |
||||
113 | $context = [ |
||||
114 | 'key' => 'value', |
||||
115 | ]; |
||||
116 | $this->sentryClient->expects($this->once())->method('captureMessage')->with($message, [ |
||||
0 ignored issues
–
show
$message of type string is incompatible with the type array expected by parameter $arguments of PHPUnit_Framework_MockOb...nvocationMocker::with() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
117 | 'extra' => $context, |
||||
118 | 'level' => 'info', |
||||
119 | ]); |
||||
120 | |||||
121 | $this->sentryLogger->info($message, $context); |
||||
122 | } |
||||
123 | |||||
124 | /** |
||||
125 | * @return void |
||||
126 | */ |
||||
127 | public function testLog() |
||||
128 | { |
||||
129 | $message = 'This is a alert'; |
||||
130 | $level = 'custom'; |
||||
131 | $context = [ |
||||
132 | 'key' => 'value', |
||||
133 | ]; |
||||
134 | $this->sentryClient->expects($this->once())->method('captureMessage')->with($message, [ |
||||
0 ignored issues
–
show
$message of type string is incompatible with the type array expected by parameter $arguments of PHPUnit_Framework_MockOb...nvocationMocker::with() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
135 | 'extra' => $context, |
||||
136 | 'level' => $level, |
||||
137 | ]); |
||||
138 | |||||
139 | $this->sentryLogger->log($level, $message, $context); |
||||
140 | } |
||||
141 | |||||
142 | /** |
||||
143 | * @return void |
||||
144 | */ |
||||
145 | View Code Duplication | public function testNotice() |
|||
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||||
146 | { |
||||
147 | $message = 'This is a alert'; |
||||
148 | $context = [ |
||||
149 | 'key' => 'value', |
||||
150 | ]; |
||||
151 | $this->sentryClient->expects($this->once())->method('captureMessage')->with($message, [ |
||||
0 ignored issues
–
show
$message of type string is incompatible with the type array expected by parameter $arguments of PHPUnit_Framework_MockOb...nvocationMocker::with() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
152 | 'extra' => $context, |
||||
153 | 'level' => 'info', |
||||
154 | ]); |
||||
155 | |||||
156 | $this->sentryLogger->notice($message, $context); |
||||
157 | } |
||||
158 | |||||
159 | /** |
||||
160 | * @return void |
||||
161 | */ |
||||
162 | View Code Duplication | public function testWarning() |
|||
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||||
163 | { |
||||
164 | $message = 'This is a alert'; |
||||
165 | $context = [ |
||||
166 | 'key' => 'value', |
||||
167 | ]; |
||||
168 | $this->sentryClient->expects($this->once())->method('captureMessage')->with($message, [ |
||||
0 ignored issues
–
show
$message of type string is incompatible with the type array expected by parameter $arguments of PHPUnit_Framework_MockOb...nvocationMocker::with() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
169 | 'extra' => $context, |
||||
170 | 'level' => 'warning', |
||||
171 | ]); |
||||
172 | |||||
173 | $this->sentryLogger->warning($message, $context); |
||||
174 | } |
||||
175 | } |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.