Issues (108)

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.

Repository/WorkflowProfileRepositoryTest.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 OpenOrchestra\FunctionalTests\ModelBundle\Repository;
4
5
use OpenOrchestra\BaseBundle\Tests\AbstractTest\AbstractKernelTestCase;
6
use OpenOrchestra\ModelInterface\Repository\WorkflowProfileRepositoryInterface;
7
use OpenOrchestra\Pagination\Configuration\PaginateFinderConfiguration;
8
9
/**
10
 * Class WorkflowProfileRepositoryTest
11
 *
12
 * @group integrationTest
13
 */
14
class WorkflowProfileRepositoryTest extends AbstractKernelTestCase
15
{
16
    /**
17
     * @var WorkflowProfileRepositoryInterface
18
     */
19
    protected $repository;
20
21
    protected $statusRepository;
22
23
    /**
24
     * Set up test
25
     */
26 View Code Duplication
    protected function setUp()
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...
27
    {
28
        parent::setUp();
29
30
        static::bootKernel();
31
        $this->repository = static::$kernel->getContainer()->get('open_orchestra_model.repository.workflow_profile');
32
        $this->statusRepository = static::$kernel->getContainer()->get('open_orchestra_model.repository.status');
33
    }
34
35
    /**
36
     * Test hasTransition
37
     *
38
     * @param string  $fromStatusName
39
     * @param string  $toStatusName
40
     * @param boolean $expectedBool
41
     *
42
     * @dataProvider provideTransitions
43
     */
44
    public function testHasTransition($fromStatusName, $toStatusName, $expectedBool)
45
    {
46
        $statusFrom = $this->statusRepository->findOneByName($fromStatusName);
47
        $statusTo = $this->statusRepository->findOneByName($toStatusName);
48
49
        $this->assertSame($expectedBool, $this->repository->hasTransition($statusFrom, $statusTo));
50
    }
51
52
    /**
53
     * Provide transition status
54
     *
55
     * @return array
56
     */
57
    public function provideTransitions()
58
    {
59
        return array(
60
            array('draft', 'toTranslate', false),
61
            array('draft', 'published'  , true),
62
        );
63
    }
64
65
    /**
66
     * @param PaginateFinderConfiguration  $configuration
67
     * @param int                          $count
68
     *
69
     * @dataProvider providePaginateAndSearch
70
     */
71
    public function testFindForPaginate(PaginateFinderConfiguration $configuration, $count)
72
    {
73
        $workflowProfiles = $this->repository->findForPaginate($configuration);
74
        $this->assertCount($count, $workflowProfiles);
75
    }
76
77
    /**
78
     * @return array
79
     */
80
    public function providePaginateAndSearch()
81
    {
82
        $configurationAll = PaginateFinderConfiguration::generateFromVariable(array(), 0, 100, array());
83
        $configurationLimit = PaginateFinderConfiguration::generateFromVariable(array(), 0, 1, array());
84
        $configurationSearch = PaginateFinderConfiguration::generateFromVariable(array(), 0, 100, array(), array('label' => 'Contributor', 'language' => 'en'));
85
        $configurationAllOrder = PaginateFinderConfiguration::generateFromVariable(array('label' => 'desc'), 0, 100, array());
86
87
        return array(
88
            'all' => array($configurationAll, 2),
89
            'limit' => array($configurationLimit, 1),
90
            'search' => array($configurationSearch, 1),
91
            'order' => array($configurationAllOrder, 2),
92
        );
93
    }
94
95
    /**
96
     * test count all workflow profile
97
     */
98
    public function testCount()
99
    {
100
        $workflowProfiles = $this->repository->count();
101
        $this->assertEquals(2, $workflowProfiles);
102
    }
103
104
    /**
105
     * @param PaginateFinderConfiguration $configuration
106
     * @param int                         $count
107
     *
108
     * @dataProvider provideCountWithFilter
109
     */
110
    public function testCountWithFilter($configuration, $count)
111
    {
112
        $workflowProfiles = $this->repository->countWithFilter($configuration);
113
        $this->assertEquals($count, $workflowProfiles);
114
    }
115
116
    /**
117
     * @return array
118
     */
119
    public function provideCountWithFilter()
120
    {
121
        $configurationAll = PaginateFinderConfiguration::generateFromVariable(array(), 0, 100, array());
122
        $configurationLimit = PaginateFinderConfiguration::generateFromVariable(array(), 0, 1, array());
123
        $configurationSearch = PaginateFinderConfiguration::generateFromVariable(array(), 0, 100, array(), array('label' => 'Contributor', 'language' => 'en'));
124
        $configurationAllOrder = PaginateFinderConfiguration::generateFromVariable(array('label' => 'desc'), 0, 100, array());
125
126
        return array(
127
            'all' => array($configurationAll, 2),
128
            'limit' => array($configurationLimit, 2),
129
            'search' => array($configurationSearch, 1),
130
            'order' => array($configurationAllOrder, 2),
131
        );
132
    }
133
134
    /**
135
     * Test remove workflow profile
136
     */
137
    public function testRemoveWorkflowProfile()
138
    {
139
        $dm = static::$kernel->getContainer()->get('object_manager');
140
        $validator = $this->repository->findOneBy(array('labels.en' => 'Validator'));
141
        $contributor = $this->repository->findOneBy(array('labels.en' => 'Contributor'));
142
143
        $workflowProfileIds = array($validator->geTId(), $contributor->getId());
144
145
        $this->repository->removeWorkflowProfiles($workflowProfileIds);
146
        $this->assertNull($this->repository->findOneBy(array('labels.en' => 'Validator')));
147
        $this->assertNull($this->repository->findOneBy(array('labels.en' => 'Contributor')));
148
149
        $dm->persist(clone $validator);
150
        $dm->persist(clone $contributor);
151
        $dm->flush();
152
    }
153
}
154