Skip to content

Commit

Permalink
shorter tests
Browse files Browse the repository at this point in the history
  • Loading branch information
markhuot committed Oct 14, 2023
1 parent f24aaea commit eb42624
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions tests/DuplicateComponentTreeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,14 @@
$source = Entry::factory()->section('pages')->create();
$destination = Entry::factory()->section('pages')->create();
$field = Craft::$app->getFields()->getFieldByHandle('myKeystoneField');
$data = new ComponentData;
$data->type = 'keystone/test';
$data->save();

foreach ($sourceIds as $sortOrder => $sourceId) {
$sourceId = is_array($sourceId) ? $sourceId : ['id' => $sourceId];
Component::factory()->create(['elementId' => $source->id, 'fieldId' => $field->id, 'dataId' => $data->id, 'sortOrder' => $sortOrder, ...$sourceId]);
Component::factory()->create(['elementId' => $source->id, 'fieldId' => $field->id, 'sortOrder' => $sortOrder, ...$sourceId]);
}
foreach ($destinationIds as $sortOrder => $destinationId) {
$destinationId = is_array($destinationId) ? $destinationId : ['id' => $destinationId];
Component::factory()->create(['elementId' => $destination->id, 'fieldId' => $field->id, 'dataId' => $data->id, 'sortOrder' => $sortOrder, ...$destinationId]);
Component::factory()->create(['elementId' => $destination->id, 'fieldId' => $field->id, 'sortOrder' => $sortOrder, ...$destinationId]);
}

return [$source, $destination, $field];
Expand Down

0 comments on commit eb42624

Please sign in to comment.