Issues (569)

Security Analysis    not enabled

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.

src/Task/Testing/PHPUnit.php (1 issue)

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 Robo\Task\Testing;
4
5
use Robo\Contract\CommandInterface;
6
use Robo\Contract\PrintedInterface;
7
use Robo\Task\BaseTask;
8
9
/**
10
 * Runs PHPUnit tests
11
 *
12
 * ``` php
13
 * <?php
14
 * $this->taskPHPUnit()
15
 *  ->group('core')
16
 *  ->bootstrap('test/bootstrap.php')
17
 *  ->run()
18
 *
19
 * ?>
20
 * ```
21
 */
22
class PHPUnit extends BaseTask implements CommandInterface, PrintedInterface
23
{
24
    use \Robo\Common\ExecOneCommand;
25
26
    /**
27
     * @var string
28
     */
29
    protected $command;
30
31
    /**
32
     * Directory of test files or single test file to run. Appended to
33
     * the command and arguments.
34
     *
35
     * @var string
36
     */
37
    protected $files = '';
38
39
    /**
40
     * PHPUnit constructor.
41
     *
42
     * @param null|string $pathToPhpUnit
43
     *
44
     * @throws \Robo\Exception\TaskException
45
     */
46 View Code Duplication
    public function __construct($pathToPhpUnit = null)
47
    {
48
        $this->command = $pathToPhpUnit;
49
        if (!$this->command) {
50
            $this->command = $this->findExecutablePhar('phpunit');
51
        }
52
        if (!$this->command) {
53
            throw new \Robo\Exception\TaskException(__CLASS__, "Neither local phpunit nor global composer installation not found");
54
        }
55
    }
56
57
    /**
58
     * @param string $filter
59
     *
60
     * @return $this
61
     */
62
    public function filter($filter)
63
    {
64
        $this->option('filter', $filter);
65
        return $this;
66
    }
67
68
    /**
69
     * @param string $group
70
     *
71
     * @return $this
72
     */
73
    public function group($group)
74
    {
75
        $this->option("group", $group);
76
        return $this;
77
    }
78
79
    /**
80
     * @param string $group
81
     *
82
     * @return $this
83
     */
84
    public function excludeGroup($group)
85
    {
86
        $this->option("exclude-group", $group);
87
        return $this;
88
    }
89
90
    /**
91
     * adds `log-json` option to runner
92
     *
93
     * @param string $file
94
     *
95
     * @return $this
96
     */
97
    public function json($file = null)
98
    {
99
        $this->option("log-json", $file);
100
        return $this;
101
    }
102
103
    /**
104
     * adds `log-junit` option
105
     *
106
     * @param string $file
107
     *
108
     * @return $this
109
     */
110
    public function xml($file = null)
111
    {
112
        $this->option("log-junit", $file);
113
        return $this;
114
    }
115
116
    /**
117
     * @param string $file
118
     *
119
     * @return $this
120
     */
121
    public function tap($file = "")
122
    {
123
        $this->option("log-tap", $file);
124
        return $this;
125
    }
126
127
    /**
128
     * @param string $file
129
     *
130
     * @return $this
131
     */
132
    public function bootstrap($file)
133
    {
134
        $this->option("bootstrap", $file);
135
        return $this;
136
    }
137
138
    /**
139
     * @param string $file
140
     *
141
     * @return $this
142
     */
143
    public function configFile($file)
144
    {
145
        $this->option('-c', $file);
146
        return $this;
147
    }
148
149
    /**
150
     * @return $this
151
     */
152
    public function debug()
153
    {
154
        $this->option("debug");
155
        return $this;
156
    }
157
158
    /**
159
     * Directory of test files or single test file to run.
160
     *
161
     * @param string $files
162
     *   A single test file or a directory containing test files.
163
     *
164
     * @return $this
165
     *
166
     * @throws \Robo\Exception\TaskException
167
     *
168
     * @deprecated Use file() or dir() method instead
169
     */
170
    public function files($files)
171
    {
172
        if (!empty($this->files) || is_array($files)) {
173
            throw new \Robo\Exception\TaskException(__CLASS__, "Only one file or directory may be provided.");
174
        }
175
        $this->files = ' ' . $files;
176
177
        return $this;
178
    }
179
180
    /**
181
     * Test the provided file.
182
     *
183
     * @param string $file
184
     *   Path to file to test.
185
     *
186
     * @return $this
187
     */
188
    public function file($file)
189
    {
190
        return $this->files($file);
0 ignored issues
show
Deprecated Code introduced by
The method Robo\Task\Testing\PHPUnit::files() has been deprecated with message: Use file() or dir() method instead

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
191
    }
192
193
    /**
194
     * {@inheritdoc}
195
     */
196
    public function getCommand()
197
    {
198
        return $this->command . $this->arguments . $this->files;
199
    }
200
201
    /**
202
     * {@inheritdoc}
203
     */
204
    public function run()
205
    {
206
        $this->printTaskInfo('Running PHPUnit {arguments}', ['arguments' => $this->arguments]);
207
        return $this->executeCommand($this->getCommand());
208
    }
209
}
210