Issues (94)

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/Unit/Provider/FakerTest.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
namespace TildBJ\Seeder\Tests\Unit\Provider;
3
4
/***************************************************************
5
 *
6
 *  Copyright notice
7
 *
8
 *  (c) 2016 Dennis Römmich <[email protected]>
9
 *
10
 *  All rights reserved
11
 *
12
 *  This script is part of the TYPO3 project. The TYPO3 project is
13
 *  free software; you can redistribute it and/or modify
14
 *  it under the terms of the GNU General Public License as published by
15
 *  the Free Software Foundation; either version 3 of the License, or
16
 *  (at your option) any later version.
17
 *
18
 *  The GNU General Public License can be found at
19
 *  http://www.gnu.org/copyleft/gpl.html.
20
 *
21
 *  This script is distributed in the hope that it will be useful,
22
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
23
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24
 *  GNU General Public License for more details.
25
 *
26
 *  This copyright notice MUST APPEAR in all copies of the script!
27
 ***************************************************************/
28
use TildBJ\Seeder\Provider\Faker;
29
use Nimut\TestingFramework\TestCase\UnitTestCase;
30
31
/**
32
 * Test case for class \TildBJ\Seeder\Provider\Faker
33
 *
34
 * @author Dennis Römmich <[email protected]>
35
 */
36
class FakerTest extends UnitTestCase
37
{
38
    /**
39
     * @var Faker $subject
40
     */
41
    protected $subject;
42
43
    protected function setUp()
44
    {
45
        $faker = \Faker\Factory::create();
46
        $faker->seed(1234);
47
        $this->subject = new Faker($faker);
48
        $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['seeder']['provider']['customdata'] =
49
            \TildBJ\Seeder\Tests\Unit\Provider\CustomDataProvider::class;
50
    }
51
52
    protected function tearDown()
53
    {
54
        unset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['seeder']['provider']['customdata']);
55
    }
56
57
    /**
58
     * @method guessProviderName
59
     * @test
60
     * @throws \TildBJ\Seeder\Provider\NotFoundException
61
     */
62
    public function guessProviderNameByKeyWithEmptyArgumentThrowsNotFoundException()
63
    {
64
        $this->expectException(
65
            \TildBJ\Seeder\Provider\NotFoundException::class
66
        );
67
        $this->subject->guessProviderName('');
68
    }
69
70
    /**
71
     * @method guessProviderName
72
     * @test
73
     * @throws \TildBJ\Seeder\Provider\NotFoundException
74
     */
75
    public function guessProviderNameReturnsProvidername()
76
    {
77
        $this->assertSame('postcode', $this->subject->guessProviderName('zip'));
78
    }
79
80
    /**
81
     * @method guessProviderNameByKey
82
     * @test
83
     * @throws \TildBJ\Seeder\Provider\NotFoundException
84
     */
85
    public function guessProviderNameByKeyReturnsNullIfNotFound()
86
    {
87
        $this->assertSame(null, $this->subject->guessProviderName('doesnotexist'));
88
    }
89
90
    /**
91
     * @method get
92
     * @test
93
     * @throws \TildBJ\Seeder\Provider\NotFoundException
94
     */
95
    public function getThrowsExceptionIfNoProviderWasFound()
96
    {
97
        $this->expectException(\TildBJ\Seeder\Provider\NotFoundException::class);
98
        $this->subject->get('doesnotexist');
99
    }
100
101
    /**
102
     * @method get
103
     * @test
104
     * @throws \TildBJ\Seeder\Provider\NotFoundException
105
     */
106
    public function getZipReturnsPostcode()
107
    {
108
        $this->assertSame('49766-3666', $this->subject->get('zip'));
109
    }
110
111
    /**
112
     * @method get
113
     * @test
114
     * @throws \TildBJ\Seeder\Provider\NotFoundException
115
     */
116
    public function getPostcodeReturnsPostcode()
117
    {
118
        $this->assertSame('49766-3666', $this->subject->get('postcode'));
119
    }
120
121
    /**
122
     * @method get
123
     * @test
124
     * @throws \TildBJ\Seeder\Provider\NotFoundException
125
     */
126
    public function getPostcodeWithUnderscoreReturnsPostcode()
127
    {
128
        $this->assertSame('49766-3666', $this->subject->get('post_code'));
129
    }
130
131
    /**
132
     * @method get
133
     * @test
134
     * @throws \TildBJ\Seeder\Provider\NotFoundException
135
     */
136
    public function getPostcodeWithWeiredCaseReturnsPostcode()
137
    {
138
        $this->assertSame('49766-3666', $this->subject->get('poSt_COde'));
139
    }
140
141
    /**
142
     * @method get
143
     * @test
144
     * @throws \TildBJ\Seeder\Provider\NotFoundException
145
     */
146
    public function getPostcodeWithUpperCaseReturnsPostcode()
147
    {
148
        $this->assertSame('49766-3666', $this->subject->get('POSTCODE'));
149
    }
150
151
    /**
152
     * @method get
153
     * @test
154
     * @throws \TildBJ\Seeder\Provider\NotFoundException
155
     */
156
    public function guessProviderNameReturnsNullWithSkippedFieldName()
157
    {
158
        $skippedFieldName = 'l10n_parent';
159
        $this->assertSame(null, $this->subject->guessProviderName($skippedFieldName));
160
    }
161
162
    /**
163
     * @method __call
164
     * @test
165
     */
166
    public function returnCustomDataIfCustomProviderIsAvailable()
167
    {
168
        $this->assertSame('customData', $this->subject->getCustomData());
0 ignored issues
show
Documentation Bug introduced by
The method getCustomData does not exist on object<TildBJ\Seeder\Provider\Faker>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
169
    }
170
}
171