Issues (32)

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/Manager/FeatureManagerTest.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 Developtech\AgilityBundle\Tests\Manager;
4
5
use Developtech\AgilityBundle\Manager\FeatureManager;
6
7
use Developtech\AgilityBundle\Entity\Feature;
8
use Developtech\AgilityBundle\Tests\Mock\User;
9
use Developtech\AgilityBundle\Entity\Project;
10
11
use Developtech\AgilityBundle\Utils\Slugger;
12
13
class FeatureManagerTest extends \PHPUnit_Framework_TestCase {
14
    /** @var FeatureManager **/
15
    protected $manager;
16
17
    public function setUp() {
18
        $this->manager = new FeatureManager($this->getEntityManagerMock(), new Slugger(), Feature::class);
0 ignored issues
show
The call to FeatureManager::__construct() has too many arguments starting with \Developtech\AgilityBundle\Entity\Feature::class.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
19
    }
20
21
    public function testGetFeature() {
22
        $feature = $this->manager->getFeature(1);
23
24
        $this->assertInstanceOf(Feature::class, $feature);
25
        $this->assertEquals(1, $feature->getId());
26
        $this->assertEquals('Calendar creation', $feature->getName());
27
    }
28
29
    /**
30
     * @expectedException \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
31
     * @expectedExceptionMessage Feature not found
32
     */
33
    public function testGetFeatureWithUnexistingFeature() {
34
        $this->manager->getFeature(2);
35
    }
36
37
    public function testGetProjectFeatures() {
38
        $features = $this->manager->getProjectFeatures((new Project()));
39
40
        $this->assertCount(3, $features);
41
        $this->assertInstanceOf(Feature::class, $features[0]);
42
        $this->assertEquals(2, $features[1]->getId());
43
    }
44
45
    public function testCreateProductOwnerFeature() {
46
        $feature = $this->manager->createProductOwnerFeature(
47
            (new Project()),
48
            'Todo list',
49
            'List of all the remaining actions to perform',
50
            Feature::STATUS_READY,
51
            95
52
        );
53
        $this->assertInstanceOf(Feature::class, $feature);
54
        $this->assertInstanceOf(Project::class, $feature->getProject());
55
        $this->assertEquals('Todo list', $feature->getName());
56
        $this->assertEquals('todo-list', $feature->getSlug());
57
        $this->assertEquals('List of all the remaining actions to perform', $feature->getDescription());
58
        $this->assertEquals(Feature::STATUS_READY, $feature->getStatus());
59
        $this->assertEquals(95, $feature->getProductOwnerValue());
60
    }
61
62
    public function getEntityManagerMock() {
63
        $entityManagerMock = $this
64
            ->getMockBuilder('Doctrine\ORM\EntityManager')
65
            ->disableOriginalConstructor()
66
            ->getMock()
67
        ;
68
        $entityManagerMock
69
            ->expects($this->any())
70
            ->method('getRepository')
71
            ->willReturnCallback([$this, 'getRepositoryMock'])
72
        ;
73
        $entityManagerMock
74
            ->expects($this->any())
75
            ->method('persist')
76
            ->willReturn(true)
77
        ;
78
        $entityManagerMock
79
            ->expects($this->any())
80
            ->method('flush')
81
            ->willReturn(true)
82
        ;
83
        return $entityManagerMock;
84
    }
85
86
    public function getRepositoryMock() {
87
        $repositoryMock = $this
88
            ->getMockBuilder('Developtech\AgilityBundle\Repository\FeatureRepository')
89
            ->disableOriginalConstructor()
90
            ->setMethods([
91
                'find',
92
                'findByProject'
93
            ])
94
            ->getMock()
95
        ;
96
        $repositoryMock
97
            ->expects($this->any())
98
            ->method('find')
99
            ->willReturnCallback([$this, 'getFeatureMock'])
100
        ;
101
        $repositoryMock
102
            ->expects($this->any())
103
            ->method('findByProject')
104
            ->willReturnCallback([$this, 'getFeaturesMock'])
105
        ;
106
        return $repositoryMock;
107
    }
108
109
    public function getFeatureMock($id) {
110
        if($id === 2) {
0 ignored issues
show
Expected 1 space after IF keyword; 0 found
Loading history...
111
            return null;
112
        }
113
        return
114
            (new Feature())
115
            ->setId(1)
116
            ->setName('Calendar creation')
117
            ->setSlug('calendar-creation')
118
            ->setDescription('Create a new calendar')
119
            ->setProject(new Project())
120
            ->setResponsible(new User())
121
            ->setCreatedAt(new \DateTime())
122
            ->setUpdatedAt(new \DateTime())
123
        ;
124
    }
125
126
    public function getFeaturesMock() {
127
        return [
128
            (new Feature())
129
            ->setId(1)
130
            ->setName('Calendar creation')
131
            ->setSlug('calendar-creation')
132
            ->setDescription('Create a new calendar')
133
            ->setProject(new Project())
134
            ->setResponsible(new User())
135
            ->setCreatedAt(new \DateTime())
136
            ->setUpdatedAt(new \DateTime()),
137
            (new Feature())
138
            ->setId(2)
139
            ->setName('Calendar edition')
140
            ->setSlug('calendar-edition')
141
            ->setDescription('Edit an existing calendar')
142
            ->setProject(new Project())
143
            ->setResponsible(new User())
144
            ->setCreatedAt(new \DateTime())
145
            ->setUpdatedAt(new \DateTime()),
146
            (new Feature())
147
            ->setId(3)
148
            ->setName('Calendar removal')
149
            ->setSlug('calendar-removal')
150
            ->setDescription('Remove an existing calendar')
151
            ->setProject(new Project())
152
            ->setResponsible(new User())
153
            ->setCreatedAt(new \DateTime())
154
            ->setUpdatedAt(new \DateTime()),
155
        ];
156
    }
157
}
158