Mod setArray macro for nested values
This commit is contained in:
parent
de4b5452ce
commit
447630e210
|
@ -174,11 +174,18 @@ class TestCase extends BaseTestCase
|
||||||
return $this;
|
return $this;
|
||||||
});
|
});
|
||||||
|
|
||||||
Testable::macro('setArray', function ($attributes) {
|
Testable::macro('setArray', function ($attributes, $value = null) {
|
||||||
$self = $this;
|
$self = $this;
|
||||||
|
if ($value === null) {
|
||||||
foreach ($attributes as $key => $value) {
|
foreach ($attributes as $key => $value) {
|
||||||
$self = $this->set($key, $value);
|
$self = $this->set($key, $value);
|
||||||
}
|
}
|
||||||
|
return $self;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($value as $key => $v) {
|
||||||
|
$self = $self->set($attributes . '.' . $key, $v);
|
||||||
|
}
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue