Skip to content

Commit ac1e5e8

Browse files
committed
add test product has attribute value
1 parent 26d55d1 commit ac1e5e8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/AttributeTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
use function Pest\Laravel\assertDatabaseCount;
99
use function PHPUnit\Framework\assertEmpty;
10+
use function PHPUnit\Framework\assertNotEmpty;
1011

1112
uses(RefreshDatabase::class);
1213

@@ -39,3 +40,11 @@
3940

4041
assertEmpty($product->attributes()->get());
4142
});
43+
44+
test('test product has attribute value', function () {
45+
$product = Product::query()->create(['title' => 'milwad-dev']);
46+
$product->attachAttribute('role', $value = 'developer');
47+
48+
assertDatabaseCount('products', 1);
49+
assertNotEmpty($product->hasAttributeValue($value));
50+
});

0 commit comments

Comments
 (0)