We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
test product has attribute value
1 parent 26d55d1 commit ac1e5e8Copy full SHA for ac1e5e8
tests/AttributeTest.php
@@ -7,6 +7,7 @@
7
8
use function Pest\Laravel\assertDatabaseCount;
9
use function PHPUnit\Framework\assertEmpty;
10
+use function PHPUnit\Framework\assertNotEmpty;
11
12
uses(RefreshDatabase::class);
13
@@ -39,3 +40,11 @@
39
40
41
assertEmpty($product->attributes()->get());
42
});
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