Add testable macro for setArray
This commit is contained in:
parent
000a5abd6f
commit
e1e678ee66
|
@ -12,6 +12,7 @@ use Illuminate\Support\Arr;
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
use Illuminate\Testing\AssertableJsonString;
|
use Illuminate\Testing\AssertableJsonString;
|
||||||
use Illuminate\Testing\TestResponse;
|
use Illuminate\Testing\TestResponse;
|
||||||
|
use Livewire\Features\SupportTesting\Testable;
|
||||||
use Phake;
|
use Phake;
|
||||||
use PHPUnit\Framework\Assert;
|
use PHPUnit\Framework\Assert;
|
||||||
use Tests\Lib\MakesHttpCalls;
|
use Tests\Lib\MakesHttpCalls;
|
||||||
|
@ -172,5 +173,14 @@ class TestCase extends BaseTestCase
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Testable::macro('setArray', function ($attributes) {
|
||||||
|
$self = $this;
|
||||||
|
foreach ($attributes as $key => $value) {
|
||||||
|
$self = $this->set($key, $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $self;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue