GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (8)

Security Analysis    no request data  

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

  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  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.
  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.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
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.

tests/RbCommentTest/Model/CommentTableTest.php (2 issues)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
namespace RbCommentTest\Model;
3
4
use RbComment\Model\Comment;
5
use RbComment\Model\CommentTable;
6
use Zend\Db\Sql\Select;
7
use Zend\Db\ResultSet\ResultSet;
8
use PHPUnit_Framework_TestCase;
9
use Zend\Db\TableGateway\TableGateway;
10
11
class CommentTableTest extends PHPUnit_Framework_TestCase
12
{
13
    private $tableGatewayMock;
14
15
    public function setUp()
16
    {
17
        $this->tableGatewayMock = $this->createMock(TableGateway::class);
18
    }
19
20
    /**
21
     * @group table
22
     */
23
    public function testConstructorStoresDependencies()
24
    {
25
        $commentTable = new CommentTable($this->tableGatewayMock);
26
27
        // Assertions
28
        $this->assertAttributeEquals($this->tableGatewayMock, 'tableGateway', $commentTable);
29
    }
30
31
    /**
32
     * @group table
33
     */
34
    public function testFetchAllReturnsAllComments()
35
    {
36
        $resultSet = new ResultSet();
37
38
        $this->tableGatewayMock->expects($this->once())
39
                               ->method('select')
40
                               ->willReturn($resultSet);
41
42
        $commentTable = new CommentTable($this->tableGatewayMock);
43
44
        $this->assertSame($resultSet, $commentTable->fetchAll());
45
    }
46
47
    /**
48
     * @group table
49
     */
50
    public function testFetchAllForThreadReturnsAllTheCommentsInThread()
51
    {
52
        $resultSet = new ResultSet();
53
54
        $this->tableGatewayMock->expects($this->once())
55
                               ->method('selectWith')
56
                               ->willReturn($resultSet);
57
58
        $commentTable = new CommentTable($this->tableGatewayMock);
59
60
        $this->assertSame($resultSet, $commentTable->fetchAllForThread('test'));
61
    }
62
63
    /**
64
     * @group table
65
     */
66
    public function testFetchAllPendingForThreadReturnsAllThePendingCommentsInAThread()
67
    {
68
        $resultSet = new ResultSet();
69
70
        $this->tableGatewayMock->expects($this->once())
71
                               ->method('selectWith')
72
                               ->willReturn($resultSet);
73
74
        $commentTable = new CommentTable($this->tableGatewayMock);
75
76
        $this->assertSame($resultSet, $commentTable->fetchAllPendingForThread('test'));
77
    }
78
79
    /**
80
     * @group table
81
     */
82
    public function testFetchAllUsingSelectUsesTheCustomSelectAndReturnsTheResult()
83
    {
84
        $resultSetMock = new ResultSet();
85
        $selectMock    = new Select();
86
87
        $this->tableGatewayMock->expects($this->once())
88
                               ->method('selectWith')
89
                               ->with($selectMock)
90
                               ->willReturn($resultSetMock);
91
92
        $commentTableMock = new CommentTable($this->tableGatewayMock);
93
94
        $this->assertSame(
95
            $resultSetMock,
96
            $commentTableMock->fetchAllUsingSelect($selectMock)
97
        );
98
    }
99
100
    /**
101
     * @group table
102
     */
103
    public function testCanRetrieveACommentByItsId()
104
    {
105
        $commentData = [
106
            'id'      => 12345,
107
            'thread'  => 'f133a4599372cf531bcdbfeb1116b9afe8d09b4f',
108
            'uri'     => '/test',
109
            'author'  => 'Robert Boloc',
110
            'contact' => '[email protected]',
111
            'content' => 'Bla bla bla',
112
            'visible' => 1,
113
            'spam'    => 0,
114
        ];
115
116
        $comment = new Comment();
117
        $comment->exchangeArray($commentData);
118
119
        $resultSet = new ResultSet();
120
        $resultSet->setArrayObjectPrototype(new Comment());
0 ignored issues
show
new \RbComment\Model\Comment() is of type object<RbComment\Model\Comment>, but the function expects a object<ArrayObject>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
121
        $resultSet->initialize([$commentData]);
122
123
        $this->tableGatewayMock->expects($this->once())
124
                               ->method('select')
125
                               ->with(['id' => 12345])
126
                               ->will($this->returnValue($resultSet));
127
128
        $commentTable = new CommentTable($this->tableGatewayMock);
129
130
        $this->assertEquals($comment, $commentTable->getComment(12345));
131
    }
132
133
    /**
134
     * @group table
135
     */
136
    public function testSaveCommentWillInsertNewCommentIfDoesNotAlreadyHaveAnId()
137
    {
138
        $comment = new Comment();
139
        $commentData = [
140
            'thread'  => 'f133a4599372cf531bcdbfeb1116b9afe8d09b4f',
141
            'uri'     => '/test',
142
            'author'  => 'Robert Boloc',
143
            'contact' => '[email protected]',
144
            'content' => 'Bla bla bla',
145
            'visible' => 1,
146
            'spam'    => 0,
147
        ];
148
149
        $comment->exchangeArray($commentData);
150
151
        $this->tableGatewayMock->expects($this->once())
152
                               ->method('insert')
153
                               ->with($commentData);
154
155
        $commentTable = new CommentTable($this->tableGatewayMock);
156
        $commentTable->saveComment($comment);
157
    }
158
159
    /**
160
     * @group table
161
     */
162
    public function testSaveCommentWillUpdateExistingCommentIfItAlreadyHasAnId()
163
    {
164
        $comment = new Comment();
165
        $commentData = [
166
            'id'      => 12345,
167
            'thread'  => 'f133a4599372cf531bcdbfeb1116b9afe8d09b4f',
168
            'uri'     => '/test',
169
            'author'  => 'Robert Boloc',
170
            'contact' => '[email protected]',
171
            'content' => 'Bla bla bla',
172
            'visible' => 1,
173
            'spam'    => 0,
174
        ];
175
176
        $comment->exchangeArray($commentData);
177
178
        $resultSet = new ResultSet();
179
        $resultSet->setArrayObjectPrototype(new Comment());
0 ignored issues
show
new \RbComment\Model\Comment() is of type object<RbComment\Model\Comment>, but the function expects a object<ArrayObject>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
180
        $resultSet->initialize([$commentData]);
181
182
        $this->tableGatewayMock->expects($this->once())
183
                               ->method('select')
184
                               ->with(['id' => 12345])
185
                               ->will($this->returnValue($resultSet));
186
187
        $updateWith = [
188
            'thread'  => 'f133a4599372cf531bcdbfeb1116b9afe8d09b4f',
189
            'uri'     => '/test',
190
            'author'  => 'Robert Boloc',
191
            'contact' => '[email protected]',
192
            'content' => 'Bla bla bla',
193
            'visible' => 1,
194
            'spam'    => 0,
195
        ];
196
197
        $this->tableGatewayMock->expects($this->once())
198
                               ->method('update')
199
                               ->with($updateWith, ['id' => 12345]);
200
201
        $commentTable = new CommentTable($this->tableGatewayMock);
202
        $commentTable->saveComment($comment);
203
    }
204
205
    /**
206
     * @group table
207
     */
208
    public function testCanDeleteACommentByItsId()
209
    {
210
        $this->tableGatewayMock->expects($this->once())
211
                               ->method('delete')
212
                               ->with(['id' => 12345]);
213
214
        $commentTable = new CommentTable($this->tableGatewayMock);
215
        $commentTable->deleteComment(12345);
216
    }
217
218
    /**
219
     * @group table
220
     */
221
    public function testCanDeleteSpam()
222
    {
223
        $this->tableGatewayMock->expects($this->once())
224
                               ->method('delete')
225
                               ->with(['spam' => 1]);
226
227
        $commentTable = new CommentTable($this->tableGatewayMock);
228
        $commentTable->deleteSpam();
229
    }
230
}
231