Skip to content

Commit 29a820d

Browse files
committed
Use getter skipping mutators
1 parent bfafdfe commit 29a820d

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/Models/AbstractAttribute.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function getTable()
3535
protected function rawValue(): Attribute
3636
{
3737
return Attribute::get(function ($value) {
38-
$value ??= $this->getAttribute('value');
38+
$value ??= $this->getAttributeFromArray('value');
3939
$class = config('rapidez.attribute-models')[$this->backend_model] ?? null;
4040

4141
if ($class) {

tests/Unit/ProductTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ public function product_has_custom_attributes()
161161
{
162162
$product = Product::find(10);
163163

164-
$this->assertEqualsCanonicalizing([8, 11], iterator_to_array($product->activity->value), 'Activity attribute on product 10 did not return the right values.');
164+
$this->assertEqualsCanonicalizing([8, 11], iterator_to_array($product->activity->rawValue), 'Activity attribute on product 10 did not return the right values.');
165+
$this->assertEqualsCanonicalizing(['Gym', 'Yoga'], iterator_to_array($product->activity->value), 'Activity attribute on product 10 did not return the right values.');
165166
$this->assertEquals('Gym, Yoga', $product->activity->label, 'Activity attribute on product 10 did not yield the right text output.');
166167

167168
$this->assertEquals('Savvy Shoulder Tote', $product->name->label, 'Name attribute on product 10 did not return the right value.');

0 commit comments

Comments
 (0)