Issues (201)

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/Model/ArticleTest.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 Redaxscript\Tests\Model;
3
4
use Redaxscript\Db;
5
use Redaxscript\Model;
6
use Redaxscript\Tests\TestCaseAbstract;
7
8
/**
9
 * ArticleTest
10
 *
11
 * @since 4.0.0
12
 *
13
 * @package Redaxscript
14
 * @category Tests
15
 * @author Henry Ruhs
16
 *
17
 * @covers Redaxscript\Model\Article
18
 */
19
20
class ArticleTest extends TestCaseAbstract
21
{
22
	/**
23
	 * setUp
24
	 *
25
	 * @since 4.0.0
26
	 */
27
28
	public function setUp() : void
29
	{
30
		parent::setUp();
31
		$optionArray = $this->getOptionArray();
32
		$installer = $this->installerFactory();
33
		$installer->init();
34
		$installer->rawCreate();
35
		$installer->insertSettings($optionArray);
36
		$categoryOne = Db::forTablePrefix('categories')->create();
37
		$categoryOne
38
			->set(
39
			[
40
				'title' => 'Category One',
41
				'alias' => 'category-one'
42
			])
43
			->save();
44
		$categoryTwo = Db::forTablePrefix('categories')->create();
45
		$categoryTwo
46
			->set(
47
			[
48
				'title' => 'Category Two',
49
				'alias' => 'category-two',
50
				'language' => 'en',
51
				'parent' => $categoryOne->id
52
			])
53
			->save();
54
		$categoryTwoSister = Db::forTablePrefix('categories')->create();
55
		$categoryTwoSister
56
			->set(
57
			[
58
				'title' => 'Category Two Sister',
59
				'alias' => 'category-two-sister',
60
				'language' => 'de',
61
				'sibling' => $categoryTwo->id
62
			])
63
			->save();
64
		Db::forTablePrefix('articles')
65
			->create()
66
			->set(
67
			[
68
				'title' => 'Article One',
69
				'alias' => 'article-one',
70
				'category' => $categoryOne->id
71
			])
72
			->save();
73
		Db::forTablePrefix('articles')
74
			->create()
75
			->set(
76
			[
77
				'title' => 'Article Two',
78
				'alias' => 'article-two',
79
				'category' => $categoryTwo->id
80
			])
81
			->save();
82
		$articleThree = Db::forTablePrefix('articles')->create();
83
		$articleThree
84
			->set(
85
			[
86
				'title' => 'Article Three',
87
				'alias' => 'article-three',
88
				'language' => 'en',
89
				'category' => $categoryTwo->id
90
			])
91
			->save();
92
		Db::forTablePrefix('articles')
93
			->create()
94
			->set(
95
				[
96
					'title' => 'Article Three Sister',
97
					'alias' => 'article-three-sister',
98
					'language' => 'de',
99
					'sibling' => $articleThree->id,
100
					'category' => $categoryTwoSister->id
101
				])
102
			->save();
103
		Db::forTablePrefix('articles')
104
			->create()
105
			->set(
106
			[
107
				'title' => 'Article Four',
108
				'alias' => 'article-four'
109
			])
110
			->save();
111
	}
112
113
	/**
114
	 * tearDown
115
	 *
116
	 * @since 4.0.0
117
	 */
118
119
	public function tearDown() : void
120
	{
121
		$this->dropDatabase();
122
	}
123
124
	/**
125
	 * testGetByAlias
126
	 *
127
	 * @since 4.0.0
128
	 *
129
	 * @param string $articleAlias
130
	 * @param int $expect
131
	 *
132
	 * @dataProvider providerAutoloader
133
	 */
134
135
	public function testGetByAlias(string $articleAlias = null, int $expect = null) : void
136
	{
137
		/* setup */
138
139
		$articleModel = new Model\Article();
140
141
		/* actual */
142
143
		$actual = $articleModel->getByAlias($articleAlias)?->id;
0 ignored issues
show
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_OBJECT_OPERATOR
Loading history...
144
145
		/* compare */
146
147
		$this->assertEquals($expect, $actual);
148
	}
149
150
	/**
151
	 *
152
	 * testCountByCategoryAndLanguage
153
	 *
154
	 * @since 4.0.0
155
	 *
156
	 * @param int $categoryId
157
	 * @param string $language
158
	 * @param int $expect
159
	 *
160
	 * @dataProvider providerAutoloader
161
	 */
162
163
	public function testCountByCategoryAndLanguage(int $categoryId = null, string $language = null, int $expect = null) : void
164
	{
165
		/* setup */
166
167
		$articleModel = new Model\Article();
168
169
		/* actual */
170
171
		$actual = $articleModel->countByCategoryAndLanguage($categoryId, $language);
172
173
		/* compare */
174
175
		$this->assertEquals($expect, $actual);
176
	}
177
178
	/**
179
	 * testGetSiblingByCategoryAndLanguageAndOrderAndStep
180
	 *
181
	 * @since 4.0.0
182
	 *
183
	 * @param int $categoryId
184
	 * @param string $language
185
	 * @param string $orderColumn
186
	 * @param int $limitStep
187
	 * @param array $expectArray
188
	 *
189
	 * @dataProvider providerAutoloader
190
	 */
191
192
	public function testGetSiblingByCategoryAndLanguageAndOrderAndStep(int $categoryId = null, string $language = null, string $orderColumn = null, int $limitStep = null, array $expectArray = []) : void
193
	{
194
		/* setup */
195
196
		$articleModel = new Model\Article();
197
		$setting = $this->settingFactory();
198
		$setting->set('limit', 1);
199
200
		/* actual */
201
202
		$actualArray = [];
203
		$actualObject = $articleModel->getSiblingByCategoryAndLanguageAndOrderAndStep($categoryId, $language, $orderColumn, $limitStep);
204
205
		/* process articles */
206
207
		foreach ($actualObject as $value)
208
		{
209
			$actualArray[] = $value->alias ?? null;
210
		}
211
212
		/* compare */
213
214
		$this->assertEquals($expectArray, $actualArray);
215
	}
216
217
	/**
218
	 * testGetRouteById
219
	 *
220
	 * @since 4.0.0
221
	 *
222
	 * @param int $articleId
223
	 * @param string $expect
224
	 *
225
	 * @dataProvider providerAutoloader
226
	 */
227
228
	public function testGetRouteById(int $articleId = null, string $expect = null) : void
229
	{
230
		/* setup */
231
232
		$articleModel = new Model\Article();
233
234
		/* actual */
235
236
		$actual = $articleModel->getRouteById($articleId);
237
238
		/* compare */
239
240
		$this->assertEquals($expect, $actual);
241
	}
242
}
243