/** @test */ function it_retrieve_notification_by_paginating_the_number() { app('config')->set('notifynder.polymorphic', false); $extraValues = json_encode(['look' => 'Amazing']); $category = $this->createCategory(['text' => 'parse this {extra.look} value']); $notification = $this->createNotification(['extra' => $extraValues, 'category_id' => $category->id]); $notifications = $this->notification->getNotRead($notification->to->id, 10, true); $bodyParsed = 'parse this Amazing value'; $this->assertEquals($bodyParsed, $notifications->items()[0]->text); }
/** @test */ public function it_retrieve_notifications_toarray() { $extraValues = json_encode(['look' => 'Amazing']); $category = $this->createCategory(['text' => 'parse this {extra.look} value']); $notification = $this->createNotification(['extra' => $extraValues, 'category_id' => $category->id]); $notifications = $this->notification->getNotRead($notification->to->id)->toArray(); $this->assertInternalType('array', $notifications); $this->assertCount(1, $notifications); $this->assertInternalType('array', $notifications[0]); $this->assertArrayHasKey('extra', $notifications[0]); $this->assertInternalType('array', $notifications[0]['extra']); $this->assertEquals('Amazing', $notifications[0]['extra']['look']); }