Issues (82)

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/Workflow/ResultTest.php (6 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 Maketok\DataMigration\Workflow;
4
5
class ResultTest extends \PHPUnit_Framework_TestCase
6
{
7
    /**
8
     * @var Result
9
     */
10
    private $result;
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
11
12
    public function setUp()
13
    {
14
        $this->result = new Result();
15
    }
16
17
    /**
18
     * @test
19
     */
20
    public function testGetAllErrors()
21
    {
22
        $this->result->addActionError('test_action', 'Error message1');
23
        $this->result->addActionError('test_action2', 'Error message2');
24
        $this->result->addActionError('test_action3', 'Error message1');
25
        $this->result->addActionError('test_action3', 'Error message2');
26
        $this->assertSame([
27
            'Error message1',
28
            'Error message2',
29
            'Error message1',
30
            'Error message2',
31
        ], $this->result->getAllErrors());
32
    }
33
34
    /**
35
     * @test
36
     */
37
    public function testGetAllExceptions()
38
    {
39
        $e1 = new \Exception('bar');
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $e1. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
40
        $e2 = new \Exception('baz');
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $e2. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
41
        $e3 = new \Exception('zap');
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $e3. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
42
        $this->result->addActionException('test_action', $e1);
43
        $this->result->addActionException('test_action2', $e2);
44
        $this->result->addActionException('test_action2', $e3);
45
        $this->assertEquals([$e1, $e2, $e3], $this->result->getAllExceptions());
46
    }
47
48
    /**
49
     * @test
50
     */
51
    public function testGetParticipants()
52
    {
53
        $start1 = new \DateTime();
54
        $end2 = new \DateTime();
55
        $e = new \Exception();
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $e. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
56
        $this->result->setActionStartTime('test1', $start1);
57
        $this->result->setActionEndTime('test2', $end2);
58
        $this->result->addActionError('test3', 'error');
59
        $this->result->addActionException('test2', $e);
60
        $this->result->addActionError('test2', 'err');
61
        $this->result->incrementActionProcessed('test4');
62
        $this->result->incrementActionProcessed('test2');
63
64
        $this->assertEquals([
65
            'test1' => [
66
                'start_time' => $start1,
67
            ],
68
            'test2' => [
69
                'end_time' => $end2,
70
                'exceptions' => [$e],
71
                'errors' => ['err'],
72
                'rows_processed' => 1,
73
            ],
74
            'test3' => [
75
                'errors' => ['error'],
76
            ],
77
            'test4' => [
78
                'rows_processed' => 1,
79
            ],
80
        ], $this->result->getParticipants());
81
    }
82
83
    /**
84
     * @test
85
     */
86
    public function testGetTotalRowsProcessed()
87
    {
88
        $this->result->incrementActionProcessed('test4', 1);
89
        $this->result->incrementActionProcessed('test1', 100);
90
91
        $this->assertSame(101, $this->result->getTotalRowsProcessed());
92
    }
93
94
    /**
95
     * @test
96
     */
97
    public function testGetTotalRowsThrough()
98
    {
99
        $this->result->incrementActionProcessed('test4', 1);
100
        $this->result->incrementActionProcessed('test1', 100);
101
        $this->result->incrementActionProcessed('test1', 1);
102
103
        $this->assertSame(1, $this->result->getTotalRowsThrough());
104
    }
105
106
    /**
107
     * @test
108
     */
109
    public function testGetTimes()
110
    {
111
        $dt = new \DateTime();
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $dt. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
112
        $dt2 = new \DateTime('+1 minute');
113
        $this->result->setStartTime($dt);
114
        $this->result->setEndTime($dt2);
115
        $this->result->setActionStartTime('test', $dt);
116
        $this->result->setActionEndTime('test', $dt2);
117
        $this->result->setActionStartTime('test', $dt2);
118
        $this->result->setActionEndTime('test', $dt);
119
120
        $this->assertSame($dt, $this->result->getStartTime());
121
        $this->assertSame($dt2, $this->result->getEndTime());
122
        $this->assertSame($dt2, $this->result->getActionStartTime('test'));
123
        $this->assertSame($dt, $this->result->getActionEndTime('test'));
124
    }
125
126
    /**
127
     * @test
128
     */
129
    public function testGetErrors()
130
    {
131
        $this->assertEquals([], $this->result->getActionErrors('test'));
132
        $this->assertEquals([], $this->result->getActionExceptions('test'));
133
    }
134
}
135