Issues (27)

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/Repo/PaginatedKnpLabsRepoFacadeTest.php (2 issues)

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
3
namespace tests\DevBoardLib\GithubApiFacade\Repo;
4
5
use DevBoardLib\GithubApiFacade\Client\KnpLabsClientFactory;
6
use DevBoardLib\GithubApiFacade\Repo\PaginatedKnpLabsRepoFacade;
7
use Mockery as m;
8
9
/**
10
 * Class PaginatedKnpLabsRepoFacadeTest.
11
 */
12
class PaginatedKnpLabsRepoFacadeTest extends \PHPUnit_Framework_TestCase
13
{
14
    private $facade;
15
16
    public function setUp()
17
    {
18
        parent::setUp();
19
20
        $this->facade = new PaginatedKnpLabsRepoFacade(
21
            $this->getTokenAuthenticatedApiClient(),
22
            $this->provideTestRepo()
23
        );
24
    }
25
26
    /**
27
     * @group GithubIntegration
28
     * @group Live
29
     */
30
    public function testFetchRepoDetails()
31
    {
32
        $result = $this->facade->fetchDetails();
33
34
        self::assertSame($this->provideTestRepo()->getFullName(), $result['full_name']);
0 ignored issues
show
The method getFullName() does not seem to exist on object<Mockery\MockInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
35
    }
36
37
    /**
38
     * @group GithubIntegration
39
     * @group Live
40
     */
41
    public function testFetchBranch()
42
    {
43
        $result = $this->facade->fetchBranch('master');
44
45
        self::assertSame('master', $result['name']);
46
    }
47
48
    /**
49
     * @group GithubIntegration
50
     * @group Live
51
     */
52
    public function testFetchAllBranches()
53
    {
54
        self::assertCount(7, $this->facade->fetchAllBranches());
55
    }
56
57
    /**
58
     * @group GithubIntegration
59
     * @group Live
60
     */
61
    public function testFetchAllBranchNames()
62
    {
63
        self::assertCount(7, $this->facade->fetchAllBranchNames());
64
    }
65
66
    /**
67
     * @group GithubIntegration
68
     * @group Live
69
     */
70
    public function testFetchAllTags()
71
    {
72
        self::assertCount(1, $this->facade->fetchAllTags());
73
    }
74
75
    /**
76
     * @group GithubIntegration
77
     * @group Live
78
     */
79
    public function testFetchAllTagNames()
80
    {
81
        self::assertCount(1, $this->facade->fetchAllTagNames());
82
    }
83
84
    /**
85
     * @group GithubIntegration
86
     * @group Live
87
     */
88
    public function testFetchCommit()
89
    {
90
        $result = $this->facade->fetchCommit('db911bd3a3dd8bb2ad9eccbcb0a396595a51491d');
91
92
        self::assertSame('db911bd3a3dd8bb2ad9eccbcb0a396595a51491d', $result['sha']);
93
    }
94
95
    /**
96
     * @group GithubIntegration
97
     * @group Live
98
     */
99
    public function testFetchCommitStatuses()
100
    {
101
        self::assertCount(27, $this->facade->fetchCommitStatuses('db911bd3a3dd8bb2ad9eccbcb0a396595a51491d'));
102
    }
103
104
    /**
105
     * @group GithubIntegration
106
     * @group Live
107
     */
108
    public function testFetchCommitStatus()
109
    {
110
        $result = $this->facade->fetchCommitStatus('db911bd3a3dd8bb2ad9eccbcb0a396595a51491d');
111
        self::assertSame(
112
            'https://api.github.com/repos/devboard/test-hitman/commits/db911bd3a3dd8bb2ad9eccbcb0a396595a51491d',
113
            $result['commit_url']
114
        );
115
    }
116
117
    /**
118
     * @group GithubIntegration
119
     * @group Live
120
     */
121
    public function testFetchAllPullRequests()
122
    {
123
        self::assertCount(2, $this->facade->fetchAllPullRequests());
124
    }
125
126
    /**
127
     * @group GithubIntegration
128
     * @group Live
129
     */
130
    public function testFetchAllMilestones()
131
    {
132
        self::assertCount(4, $this->facade->fetchAllMilestones());
133
    }
134
135
    /**
136
     * @group GithubIntegration
137
     * @group Live
138
     */
139
    public function testFetchAllIssues()
140
    {
141
        self::assertCount(10, $this->facade->fetchAllIssues());
142
    }
143
144
    /**
145
     * @group GithubIntegration
146
     * @group Live
147
     */
148
    public function testFetchAllIssuesAndPullRequests()
149
    {
150
        self::assertCount(12, $this->facade->fetchAllIssuesAndPullRequests());
151
    }
152
153
    /**
154
     * @return \Github\Client
155
     */
156
    private function getTokenAuthenticatedApiClient()
157
    {
158
        $factory = new KnpLabsClientFactory();
159
160
        return $factory->createTokenAuthenticatedClient($this->provideTestUser());
161
    }
162
163
    /**
164
     * @return \DevBoardLib\GithubCore\Repo\GithubRepo
165
     */
166 View Code Duplication
    private function provideTestRepo()
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...
167
    {
168
        $githubRepo = m::mock('DevBoardLib\GithubCore\Repo\GithubRepo');
169
        $githubRepo->shouldReceive('getOwner')->andReturn('devboard');
170
        $githubRepo->shouldReceive('getName')->andReturn('test-hitman');
171
        $githubRepo->shouldReceive('getFullName')->andReturn('devboard/test-hitman');
172
173
        return $githubRepo;
174
    }
175
176
    /**
177
     * @return \DevBoardLib\GithubApiFacade\Auth\GithubAccessToken
178
     */
179
    private function provideTestUser()
180
    {
181
        $user = m::mock('DevBoardLib\GithubApiFacade\Auth\GithubAccessToken');
182
        $user->shouldReceive('getGithubAccessToken')->andReturn(getenv('GITHUB_ACCESS_TOKEN'));
183
184
        return $user;
185
    }
186
}
187