Issues (15)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  Header Injection
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

test/Log/SentryLoggerTest.php (15 issues)

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
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.

Loading history...
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 ignore-type  annotation

48
        $this->sentryClient->expects($this->once())->method('captureMessage')->with(/** @scrutinizer ignore-type */ $message, [
Loading history...
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.

Loading history...
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 ignore-type  annotation

65
        $this->sentryClient->expects($this->once())->method('captureMessage')->with(/** @scrutinizer ignore-type */ $message, [
Loading history...
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.

Loading history...
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 ignore-type  annotation

82
        $this->sentryClient->expects($this->once())->method('captureMessage')->with(/** @scrutinizer ignore-type */ $message, [
Loading history...
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.

Loading history...
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 ignore-type  annotation

99
        $this->sentryClient->expects($this->once())->method('captureMessage')->with(/** @scrutinizer ignore-type */ $message, [
Loading history...
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.

Loading history...
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 ignore-type  annotation

116
        $this->sentryClient->expects($this->once())->method('captureMessage')->with(/** @scrutinizer ignore-type */ $message, [
Loading history...
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 ignore-type  annotation

134
        $this->sentryClient->expects($this->once())->method('captureMessage')->with(/** @scrutinizer ignore-type */ $message, [
Loading history...
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.

Loading history...
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 ignore-type  annotation

151
        $this->sentryClient->expects($this->once())->method('captureMessage')->with(/** @scrutinizer ignore-type */ $message, [
Loading history...
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.

Loading history...
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 ignore-type  annotation

168
        $this->sentryClient->expects($this->once())->method('captureMessage')->with(/** @scrutinizer ignore-type */ $message, [
Loading history...
169
            'extra' => $context,
170
            'level' => 'warning',
171
        ]);
172
173
        $this->sentryLogger->warning($message, $context);
174
    }
175
}