From 83cc87d6d2f24a35dfcc51ce6bf2b5afa026e7de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=2E=20Nagy=20Gerg=C5=91?= Date: Sat, 30 Dec 2023 11:41:38 +0100 Subject: [PATCH] add meta test --- tests/Models/MetaTest.php | 37 +++++++++++++++++++++++++++++++ tests/Models/NotificationTest.php | 30 +++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 tests/Models/MetaTest.php create mode 100644 tests/Models/NotificationTest.php diff --git a/tests/Models/MetaTest.php b/tests/Models/MetaTest.php new file mode 100644 index 00000000..6c40b18b --- /dev/null +++ b/tests/Models/MetaTest.php @@ -0,0 +1,37 @@ +user = User::factory()->create(); + } + + public function test_a_meta_belongs_to_a_metable(): void + { + $meta = Meta::factory()->make(); + + $meta->metable()->associate($this->user)->save(); + + $this->assertTrue($meta->metable->is($this->user)); + } + + public function test_a_metable_model_has_meta_data(): void + { + $this->user->metaData()->save( + $meta = Meta::factory()->make() + ); + + $this->assertTrue($this->user->metaData->contains($meta)); + } +} diff --git a/tests/Models/NotificationTest.php b/tests/Models/NotificationTest.php new file mode 100644 index 00000000..5d5dd6b9 --- /dev/null +++ b/tests/Models/NotificationTest.php @@ -0,0 +1,30 @@ +user = User::factory()->create(); + } + + public function test_a_notification_belongs_to_a_notifiable(): void + { + $notification = Notification::factory()->make(); + + $notification->notifiable()->associate($this->user); + + $notification->save(); + + $this->assertTrue($notification->notifiable->is($this->user)); + } +}