Issues (5)

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.

features/bootstrap/FeatureContext.php (5 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
use Behat\Behat\Context\Context;
4
use Behat\Gherkin\Node\TableNode;
5
use Davispeixoto\Workflow\Exceptions\InvalidTransitionException;
6
use Davispeixoto\Workflow\Tests\Auxiliary\SalesStates;
7
use Davispeixoto\Workflow\Tests\Auxiliary\SalesWorkflow;
8
use MyCLabs\Enum\Enum;
9
use PHPUnit\Framework\Assert;
10
11
/**
12
 * Defines application features from the specific context.
13
 */
14
class FeatureContext implements Context
15
{
16
    /**
17
     * @var SalesWorkflow
18
     */
19
    private $workflow;
20
21
    /**
22
     * @var string $exceptionMessage
23
     */
24
    private $exceptionMessage;
25
26
    /**
27
     * @var string $exceptionClass
28
     */
29
    private $exceptionClass;
30
31
    /**
32
     * @var Enum
33
     */
34
    private $currentState;
35
36
    /**
37
     * Initializes context.
38
     *
39
     * Every scenario gets its own context instance.
40
     * You can also pass arbitrary arguments to the
41
     * context constructor through behat.yml.
42
     */
43
    public function __construct()
44
    {
45
        return;
46
    }
47
48
    /**
49
     * @Given there is the following states for sales:
50
     */
51
    public function thereIsTheFollowingStatesForSales(TableNode $table)
0 ignored issues
show
function thereIsTheFollowingStatesForSales() does not seem to conform to the naming convention (^(?:is|has|should|may|supports)).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
The parameter $table is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
52
    {
53
        return true;
54
    }
55
56
    /**
57
     * @Given there is the following sales lifecycle
58
     */
59
    public function thereIsTheFollowingSalesLifecycle(TableNode $table)
0 ignored issues
show
function thereIsTheFollowingSalesLifecycle() does not seem to conform to the naming convention (^(?:is|has|should|may|supports)).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
The parameter $table is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
60
    {
61
        return true;
62
    }
63
64
    /**
65
     * @Given there is the background
66
     */
67
    public function thereIsTheBackground()
0 ignored issues
show
function thereIsTheBackground() does not seem to conform to the naming convention (^(?:is|has|should|may|supports)).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
68
    {
69
        return true;
70
    }
71
72
    /**
73
     * @Given There is a sale in :arg1 state
74
     */
75
    public function thereIsASaleInState($arg1)
76
    {
77
        $values = SalesStates::values();
78
        $this->workflow = new SalesWorkflow($values[$arg1]);
79
    }
80
81
    /**
82
     * @When I change its state to :arg1
83
     */
84
    public function iChangeItsStateTo($arg1)
85
    {
86
        $this->exceptionMessage = '';
87
        $this->exceptionClass = '';
88
89
        try {
90
            $values = SalesStates::values();
91
            $this->workflow->setCurrentStatus($values[$arg1]);
92
        } catch (InvalidTransitionException $invalidTransitionException) {
93
            $this->exceptionMessage = $invalidTransitionException->getMessage();
94
            $this->exceptionClass = InvalidTransitionException::class;
95
        }
96
    }
97
98
    /**
99
     * @Then sales must be in :arg1 state
100
     */
101
    public function salesMustBeInState($arg1)
102
    {
103
        $values = SalesStates::values();
104
        $state = $values[$arg1];
105
        Assert::assertEquals($state->getValue(), $this->workflow->getCurrentStatus()->getValue());
106
    }
107
108
    /**
109
     * @Then I should receive an error message
110
     */
111
    public function iShouldReceiveAnErrorMessage()
112
    {
113
        Assert::assertEquals(InvalidTransitionException::class, $this->exceptionClass);
114
        Assert::assertNotEmpty($this->exceptionMessage);
115
    }
116
117
    /**
118
     * @When I check its state
119
     */
120
    public function iCheckItsState()
121
    {
122
        $this->currentState = $this->workflow->getCurrentStatus();
123
    }
124
125
    /**
126
     * @Then I should see it is not finished
127
     */
128
    public function iShouldSeeItIsNotFinished()
129
    {
130
        Assert::assertEquals(false, $this->workflow->isFinished());
131
    }
132
133
    /**
134
     * @Then I should see it is finished
135
     */
136
    public function iShouldSeeItIsFinished()
137
    {
138
        Assert::assertEquals(true, $this->workflow->isFinished());
139
    }
140
}
141