|
| 1 | +<?php |
| 2 | + |
| 3 | +use Fenos\Notifynder\Models\Notification; |
| 4 | + |
| 5 | +class NotificationTest extends NotifynderTestCase |
| 6 | +{ |
| 7 | + public function testFillablesEmpty() |
| 8 | + { |
| 9 | + $notification = new Notification(); |
| 10 | + $this->assertInternalType('array', $notification->getFillable()); |
| 11 | + $this->assertSame([ |
| 12 | + 'to_id', |
| 13 | + 'to_type', |
| 14 | + 'from_id', |
| 15 | + 'from_type', |
| 16 | + 'category_id', |
| 17 | + 'read', |
| 18 | + 'url', |
| 19 | + 'extra', |
| 20 | + 'expires_at', |
| 21 | + 'stack_id', |
| 22 | + ], $notification->getFillable()); |
| 23 | + } |
| 24 | + |
| 25 | + public function testFillablesCustomFillables() |
| 26 | + { |
| 27 | + $config = app('notifynder.config'); |
| 28 | + $config->set('additional_fields.fillable', ['fillable_field']); |
| 29 | + $notification = new Notification(); |
| 30 | + $this->assertInternalType('array', $notification->getFillable()); |
| 31 | + $this->assertSame([ |
| 32 | + 'to_id', |
| 33 | + 'to_type', |
| 34 | + 'from_id', |
| 35 | + 'from_type', |
| 36 | + 'category_id', |
| 37 | + 'read', |
| 38 | + 'url', |
| 39 | + 'extra', |
| 40 | + 'expires_at', |
| 41 | + 'stack_id', |
| 42 | + 'fillable_field', |
| 43 | + ], $notification->getFillable()); |
| 44 | + } |
| 45 | + |
| 46 | + public function testFillablesCustomRequired() |
| 47 | + { |
| 48 | + $config = app('notifynder.config'); |
| 49 | + $config->set('additional_fields.required', ['required_field']); |
| 50 | + $notification = new Notification(); |
| 51 | + $this->assertInternalType('array', $notification->getFillable()); |
| 52 | + $this->assertSame([ |
| 53 | + 'to_id', |
| 54 | + 'to_type', |
| 55 | + 'from_id', |
| 56 | + 'from_type', |
| 57 | + 'category_id', |
| 58 | + 'read', |
| 59 | + 'url', |
| 60 | + 'extra', |
| 61 | + 'expires_at', |
| 62 | + 'stack_id', |
| 63 | + 'required_field', |
| 64 | + ], $notification->getFillable()); |
| 65 | + } |
| 66 | + |
| 67 | + public function testFillablesCustom() |
| 68 | + { |
| 69 | + $config = app('notifynder.config'); |
| 70 | + $config->set('additional_fields.fillable', ['fillable_field']); |
| 71 | + $config->set('additional_fields.required', ['required_field']); |
| 72 | + $notification = new Notification(); |
| 73 | + $this->assertInternalType('array', $notification->getFillable()); |
| 74 | + $this->assertSame([ |
| 75 | + 'to_id', |
| 76 | + 'to_type', |
| 77 | + 'from_id', |
| 78 | + 'from_type', |
| 79 | + 'category_id', |
| 80 | + 'read', |
| 81 | + 'url', |
| 82 | + 'extra', |
| 83 | + 'expires_at', |
| 84 | + 'stack_id', |
| 85 | + 'required_field', |
| 86 | + 'fillable_field', |
| 87 | + ], $notification->getFillable()); |
| 88 | + } |
| 89 | +} |
0 commit comments