Issues (73)

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.

Units/Driver/AbstractAnnotationDriverTests.php (8 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
/**
4
 * This file is part of the Cubiche/Metadata component.
5
 *
6
 * Copyright (c) Cubiche
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Cubiche\Core\Metadata\Tests\Units\Driver;
13
14
use Cubiche\Core\Metadata\Exception\MappingException;
15
use Cubiche\Core\Metadata\Tests\Fixtures\Driver\AnnotationDriver;
16
use Doctrine\Common\Annotations\AnnotationReader;
17
use Doctrine\Common\Annotations\AnnotationRegistry;
18
use Doctrine\Common\Annotations\CachedReader;
19
use Doctrine\Common\Cache\FilesystemCache;
20
use mageekguy\atoum\adapter as Adapter;
21
use mageekguy\atoum\annotations\extractor as Extractor;
22
use mageekguy\atoum\asserter\generator as Generator;
23
use mageekguy\atoum\test\assertion\manager as Manager;
24
use mageekguy\atoum\tools\variable\analyzer as Analyzer;
25
26
/**
27
 * AbstractAnnotationDriverTests class.
28
 *
29
 * Generated by TestGenerator on 2017-05-16 at 13:17:21.
30
 */
31
class AbstractAnnotationDriverTests extends DriverTestCase
32
{
33
    /**
34
     * @var string
35
     */
36
    protected $cacheDirectory;
37
38
    /**
39
     * @param Adapter   $adapter
40
     * @param Extractor $annotationExtractor
41
     * @param Generator $asserterGenerator
42
     * @param Manager   $assertionManager
43
     * @param \Closure  $reflectionClassFactory
44
     * @param \Closure  $phpExtensionFactory
45
     * @param Analyzer  $analyzer
46
     */
47 View Code Duplication
    public function __construct(
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...
48
        Adapter $adapter = null,
49
        Extractor $annotationExtractor = null,
50
        Generator $asserterGenerator = null,
51
        Manager $assertionManager = null,
52
        \Closure $reflectionClassFactory = null,
53
        \Closure $phpExtensionFactory = null,
54
        Analyzer $analyzer = null
55
    ) {
56
        parent::__construct(
57
            $adapter,
58
            $annotationExtractor,
59
            $asserterGenerator,
60
            $assertionManager,
61
            $reflectionClassFactory,
62
            $phpExtensionFactory,
63
            $analyzer
64
        );
65
66
        $this->cacheDirectory = __DIR__.'/../Driver/Cache';
67
    }
68
69
    /**
70
     * Create the cache directory.
71
     */
72
    public function setUp()
73
    {
74
        if (!is_dir($this->cacheDirectory)) {
75
            mkdir($this->cacheDirectory);
76
        }
77
    }
78
79
    /**
80
     * Remove the cache directory.
81
     */
82
    public function tearDown()
83
    {
84
        $this->rmdir($this->cacheDirectory);
85
    }
86
87
    /**
88
     * @return AnnotationDriver
89
     */
90 View Code Duplication
    protected function createDriver()
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...
91
    {
92
        $reader = new CachedReader(
93
            new AnnotationReader(),
94
            new FilesystemCache($this->cacheDirectory),
95
            $debug = true
96
        );
97
98
        AnnotationRegistry::registerFile(__DIR__.'/../../Fixtures/Annotations/AggregateRoot.php');
0 ignored issues
show
Deprecated Code introduced by
The method Doctrine\Common\Annotati...egistry::registerFile() has been deprecated with message: this method is deprecated and will be removed in doctrine/annotations 2.0 autoloading should be deferred to the globally registered autoloader by then. For now, use @example AnnotationRegistry::registerLoader('class_exists')

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...
99
        AnnotationRegistry::registerFile(__DIR__.'/../../Fixtures/Annotations/Entity.php');
0 ignored issues
show
Deprecated Code introduced by
The method Doctrine\Common\Annotati...egistry::registerFile() has been deprecated with message: this method is deprecated and will be removed in doctrine/annotations 2.0 autoloading should be deferred to the globally registered autoloader by then. For now, use @example AnnotationRegistry::registerLoader('class_exists')

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...
100
        AnnotationRegistry::registerFile(__DIR__.'/../../Fixtures/Annotations/Field.php');
0 ignored issues
show
Deprecated Code introduced by
The method Doctrine\Common\Annotati...egistry::registerFile() has been deprecated with message: this method is deprecated and will be removed in doctrine/annotations 2.0 autoloading should be deferred to the globally registered autoloader by then. For now, use @example AnnotationRegistry::registerLoader('class_exists')

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...
101
        AnnotationRegistry::registerFile(__DIR__.'/../../Fixtures/Annotations/Id.php');
0 ignored issues
show
Deprecated Code introduced by
The method Doctrine\Common\Annotati...egistry::registerFile() has been deprecated with message: this method is deprecated and will be removed in doctrine/annotations 2.0 autoloading should be deferred to the globally registered autoloader by then. For now, use @example AnnotationRegistry::registerLoader('class_exists')

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...
102
103
        $driver = new AnnotationDriver($reader, [__DIR__.'/../../Fixtures']);
104
        $driver->addExcludePaths([
105
            __DIR__.'/../../Fixtures/Annotations',
106
            __DIR__.'/../../Fixtures/Driver',
107
            __DIR__.'/../../Fixtures/mapping',
108
            __DIR__.'/../../Fixtures/mapping-two',
109
        ]);
110
        $driver->setFileExtension('.php');
111
112
        return $driver;
113
    }
114
115
    /**
116
     * @return AnnotationDriver
117
     */
118 View Code Duplication
    protected function createEmptyDriver()
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...
119
    {
120
        $reader = new CachedReader(
121
            new AnnotationReader(),
122
            new FilesystemCache($this->cacheDirectory),
123
            $debug = true
124
        );
125
126
        return new AnnotationDriver($reader);
127
    }
128
129
    /**
130
     * @return AnnotationDriver
131
     */
132 View Code Duplication
    protected function createDriverWithInvalidPaths()
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...
133
    {
134
        $reader = new CachedReader(
135
            new AnnotationReader(),
136
            new FilesystemCache($this->cacheDirectory),
137
            $debug = true
138
        );
139
140
        return new AnnotationDriver($reader, [__DIR__.'/../../Fixtures/Foo']);
141
    }
142
143
    /**
144
     * Test excludePaths method.
145
     */
146
    public function testExcludePaths()
147
    {
148
        $this
149
            ->given($driver = $this->createDriver())
150
            ->then()
151
                ->array($driver->excludePaths())
152
                    ->hasSize(4)
153
        ;
154
    }
155
156
    /**
157
     * Test getAllClassNames method.
158
     */
159
    public function testGetAllClassNames()
160
    {
161
        parent::testGetAllClassNames();
162
163
        $this
164
            ->given($driver = $this->createDriver())
165
            ->when($classNames = $driver->getAllClassNames())
166
            ->and($classNames = $driver->getAllClassNames())
167
            ->then()
168
                ->array($classNames)
169
                    ->hasSize(4)
170
        ;
171
172
        $this
173
            ->given($driver = $this->createEmptyDriver())
174
            ->then()
175
                ->exception(function () use ($driver) {
176
                    $driver->getAllClassNames();
177
                })->isInstanceOf(MappingException::class);
178
179
        $this
180
            ->given($driver = $this->createDriverWithInvalidPaths())
181
            ->then()
182
                ->exception(function () use ($driver) {
183
                    $driver->getAllClassNames();
184
                })->isInstanceOf(MappingException::class);
185
    }
186
}
187