Skip to content

Commit

Permalink
Reformat some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stevebauman committed Jun 22, 2023
1 parent b8a334a commit 6cea0e7
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions tests/Unit/EloquentHydratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ public function test_attribute_hydrator()
{
$entry = new Entry(['bar' => 'baz']);
$model = new TestHydratorModelStub;
AttributeHydrator::with(['sync_attributes' => ['foo' => 'bar']])
->hydrate($entry, $model);

AttributeHydrator::with([
'sync_attributes' => ['foo' => 'bar'],
])->hydrate($entry, $model);

$this->assertEquals('baz', $model->foo);
}
Expand All @@ -52,8 +54,10 @@ public function test_attribute_hydrator_can_use_handle_function_of_class()
{
$entry = new Entry(['bar' => 'baz']);
$model = new TestHydratorModelStub;
AttributeHydrator::with(['sync_attributes' => [TestAttributeHandlerHandleStub::class]])
->hydrate($entry, $model);

AttributeHydrator::with([
'sync_attributes' => [TestAttributeHandlerHandleStub::class],
])->hydrate($entry, $model);

$this->assertEquals('baz', $model->foo);
}
Expand All @@ -62,8 +66,10 @@ public function test_attribute_hydrator_can_use_invokable_class()
{
$entry = new Entry(['bar' => 'baz']);
$model = new TestHydratorModelStub;
AttributeHydrator::with(['sync_attributes' => [TestAttributeHandlerInvokableStub::class]])
->hydrate($entry, $model);

AttributeHydrator::with(['sync_attributes' => [
TestAttributeHandlerInvokableStub::class,
]])->hydrate($entry, $model);

$this->assertEquals('baz', $model->foo);
}
Expand All @@ -72,12 +78,12 @@ public function test_attribute_hydrator_can_use_inline_function()
{
$entry = new Entry(['bar' => 'baz']);
$model = new TestHydratorModelStub;

AttributeHydrator::with(['sync_attributes' => [
function ($object, $eloquent) {
$eloquent->foo = $object->getFirstAttribute('bar');
}
]])
->hydrate($entry, $model);
function ($object, $eloquent) {
$eloquent->foo = $object->getFirstAttribute('bar');
},
]])->hydrate($entry, $model);

$this->assertEquals('baz', $model->foo);
}
Expand Down

0 comments on commit 6cea0e7

Please sign in to comment.