Fixes a bug that would cause non-editable variables on the front-end to throw a validation error
This commit is contained in:
parent
e2cdb3b4b1
commit
8e1aa15dba
4 changed files with 14 additions and 3 deletions
|
@ -128,9 +128,12 @@ class VariableValidatorServiceTest extends TestCase
|
|||
$messages = $exception->validator->getMessageBag()->all();
|
||||
|
||||
$this->assertNotEmpty($messages);
|
||||
$this->assertSame(4, count($messages));
|
||||
$this->assertSame(2, count($messages));
|
||||
|
||||
for ($i = 0; $i < 4; $i++) {
|
||||
// We only expect to get the first two variables form the getVariableCollection
|
||||
// function here since those are the only two that are editable, and the others
|
||||
// should be discarded and not validated.
|
||||
for ($i = 0; $i < 2; $i++) {
|
||||
$this->assertSame(trans('validation.required', [
|
||||
'attribute' => trans('validation.internal.variable_value', ['env' => $variables[$i]->name]),
|
||||
]), $messages[$i]);
|
||||
|
@ -148,8 +151,8 @@ class VariableValidatorServiceTest extends TestCase
|
|||
return collect(
|
||||
[
|
||||
factory(EggVariable::class)->states('editable', 'viewable')->make(),
|
||||
factory(EggVariable::class)->states('viewable')->make(),
|
||||
factory(EggVariable::class)->states('editable')->make(),
|
||||
factory(EggVariable::class)->states('viewable')->make(),
|
||||
factory(EggVariable::class)->make(),
|
||||
]
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue