mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-24 15:42:09 +08:00
assertSchemaSet
This commit is contained in:
@@ -127,7 +127,7 @@ it('can validate invoice recipient email', function () {
|
||||
});
|
||||
```
|
||||
|
||||
To check if an action is pre-filled with data, you can use the `assertActionDataSet()` method:
|
||||
To check if an action is pre-filled with data, you can use the `assertSchemaSet()` method:
|
||||
|
||||
```php
|
||||
use function Pest\Livewire\livewire;
|
||||
@@ -140,7 +140,7 @@ it('can send invoices to the primary contact by default', function () {
|
||||
'invoice' => $invoice,
|
||||
])
|
||||
->mountAction('send')
|
||||
->assertActionDataSet([
|
||||
->assertSchemaSet([
|
||||
'email' => $recipientEmail,
|
||||
])
|
||||
->callMountedAction()
|
||||
|
||||
@@ -79,18 +79,7 @@ class TestsActions
|
||||
public function assertActionDataSet(): Closure
|
||||
{
|
||||
return function (array | Closure $data): static {
|
||||
$mountedActions = $this->instance()->mountedActions;
|
||||
$mountedActionIndex = array_key_last($mountedActions);
|
||||
|
||||
if ($data instanceof Closure) {
|
||||
$data = $data($mountedActions[$mountedActionIndex]['data'] ?? []);
|
||||
}
|
||||
|
||||
if (is_array($data)) {
|
||||
foreach (Arr::dot($data, prepend: "mountedActions.{$mountedActionIndex}.data.") as $key => $value) {
|
||||
$this->assertSet($key, $value);
|
||||
}
|
||||
}
|
||||
$this->assertSchemaSet($data);
|
||||
|
||||
return $this;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user