/** @test */ public function should_create_notification() { $notification = new Notification(NotificationId::generate(), $this->user, new NewFollower(), 'hello world'); $this->assertInstanceOf('Cribbb\\Domain\\Model\\Identity\\Notification', $notification); $this->assertInstanceOf('Cribbb\\Domain\\Model\\Identity\\NotificationId', $notification->id()); $this->assertInstanceOf('Cribbb\\Domain\\Model\\Identity\\User', $notification->user()); $this->assertEquals('new_follower', $notification->type()); $this->assertEquals('hello world', $notification->body()); }
/** @test */ public function should_return_id_as_string() { $id = NotificationId::fromString('d16f9fe7-e947-460e-99f6-2d64d65f46bc'); $this->assertEquals('d16f9fe7-e947-460e-99f6-2d64d65f46bc', $id->toString()); $this->assertEquals('d16f9fe7-e947-460e-99f6-2d64d65f46bc', (string) $id); }
/** * Set the Notification id * * @param NotificationId $id * @return void */ private function setId(NotificationId $id) { $this->id = $id->toString(); }