1
0
mirror of https://github.com/flarum/core.git synced 2025-08-09 09:57:06 +02:00

Add integration tests for settings API endpoint

This commit is contained in:
Alexander Skvortsov
2021-11-16 16:48:09 -05:00
parent 34e0ab6100
commit 7c12e2c464
2 changed files with 87 additions and 8 deletions

View File

@@ -13,11 +13,6 @@ use Flarum\Foundation\AbstractValidator;
class SettingsValidator extends AbstractValidator
{
/**
* @var array
*/
protected $rules = [];
/**
* These rules apply to all attributes.
*
@@ -45,9 +40,7 @@ class SettingsValidator extends AbstractValidator
// Apply attribute specific rules.
foreach ($rules as $key => $value) {
if (array_key_exists($key, $this->rules)) {
$rules[$key] = array_merge($rules[$key], $this->rules[$key]);
}
$rules[$key] = array_merge($rules[$key], $this->rules[$key] ?? []);
}
$validator = $this->validator->make($attributes, $rules, $this->getMessages());