Completed
Push — master ( aed851...a3d46d )
by Nicolas
01:45
created
Tests/BaseTestCase.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -40,15 +40,15 @@
 block discarded – undo
40 40
 
41 41
     protected function getEnvironmentSetUp($app)
42 42
     {
43
-        $app['path.base'] = __DIR__ . '/..';
44
-        $app['config']->set('database.default', 'sqlite');
45
-        $app['config']->set('database.connections.sqlite', array(
43
+        $app[ 'path.base' ] = __DIR__.'/..';
44
+        $app[ 'config' ]->set('database.default', 'sqlite');
45
+        $app[ 'config' ]->set('database.connections.sqlite', array(
46 46
             'driver' => 'sqlite',
47 47
             'database' => ':memory:',
48 48
             'prefix' => '',
49 49
         ));
50
-        $app['config']->set('translatable.locales', ['en', 'fr']);
51
-        $app['config']->set('modules.paths.modules', __DIR__ . '/../Modules');
50
+        $app[ 'config' ]->set('translatable.locales', [ 'en', 'fr' ]);
51
+        $app[ 'config' ]->set('modules.paths.modules', __DIR__.'/../Modules');
52 52
     }
53 53
 
54 54
     private function resetDatabase()
Please login to merge, or discard this patch.
Tests/EloquentNotificationRepositoryTest.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
         ]);
31 31
 
32 32
         $this->assertCount(1, $this->notification->all());
33
-        $this->assertEquals('1' , $notification->user_id);
34
-        $this->assertEquals('fa fa-link' , $notification->icon_class);
35
-        $this->assertEquals('http://localhost/users' , $notification->link);
36
-        $this->assertEquals('My notification' , $notification->title);
37
-        $this->assertEquals('Is awesome!' , $notification->message);
33
+        $this->assertEquals('1', $notification->user_id);
34
+        $this->assertEquals('fa fa-link', $notification->icon_class);
35
+        $this->assertEquals('http://localhost/users', $notification->link);
36
+        $this->assertEquals('My notification', $notification->title);
37
+        $this->assertEquals('Is awesome!', $notification->message);
38 38
     }
39 39
 
40 40
     /** @test */
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
         $this->createNotification();
52 52
         $this->createNotification();
53 53
         $this->createNotification();
54
-        $this->createNotification(['user_id' => 2]);
55
-        $this->createNotification(['user_id' => 2]);
54
+        $this->createNotification([ 'user_id' => 2 ]);
55
+        $this->createNotification([ 'user_id' => 2 ]);
56 56
 
57 57
         $this->assertCount(10, $this->notification->latestForUser(1));
58 58
         $this->assertCount(2, $this->notification->latestForUser(2));
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
         $this->createNotification();
73 73
         $this->createNotification();
74 74
         $this->createNotification();
75
-        $this->createNotification(['user_id' => 2]);
76
-        $this->createNotification(['user_id' => 2]);
75
+        $this->createNotification([ 'user_id' => 2 ]);
76
+        $this->createNotification([ 'user_id' => 2 ]);
77 77
 
78 78
         $this->assertCount(11, $this->notification->allForUser(1));
79 79
         $this->assertCount(2, $this->notification->allForUser(2));
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
     public function it_can_get_all_unread_notifications_for_user()
96 96
     {
97 97
         $this->createNotification();
98
-        $this->createNotification(['is_read' => true]);
99
-        $this->createNotification(['is_read' => true]);
98
+        $this->createNotification([ 'is_read' => true ]);
99
+        $this->createNotification([ 'is_read' => true ]);
100 100
         $this->createNotification();
101 101
 
102 102
         $this->assertCount(2, $this->notification->allUnreadForUser(1));
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
     public function it_can_get_all_read_notifications_for_user()
107 107
     {
108 108
         $this->createNotification();
109
-        $this->createNotification(['is_read' => true]);
110
-        $this->createNotification(['is_read' => true]);
109
+        $this->createNotification([ 'is_read' => true ]);
110
+        $this->createNotification([ 'is_read' => true ]);
111 111
         $this->createNotification();
112 112
         $this->createNotification();
113 113
 
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
         $this->createNotification();
121 121
         $this->createNotification();
122 122
         $this->createNotification();
123
-        $this->createNotification(['user_id' => 2]);
124
-        $this->createNotification(['user_id' => 2]);
123
+        $this->createNotification([ 'user_id' => 2 ]);
124
+        $this->createNotification([ 'user_id' => 2 ]);
125 125
 
126 126
         $this->assertCount(3, $this->notification->allForUser(1));
127 127
         $this->assertCount(2, $this->notification->allForUser(2));
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
         $this->createNotification();
139 139
         $this->createNotification();
140 140
         $this->createNotification();
141
-        $this->createNotification(['user_id' => 2]);
142
-        $this->createNotification(['user_id' => 2]);
141
+        $this->createNotification([ 'user_id' => 2 ]);
142
+        $this->createNotification([ 'user_id' => 2 ]);
143 143
 
144 144
         $this->assertCount(0, $this->notification->allReadForUser(1));
145 145
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         $this->assertCount(3, $this->notification->allReadForUser(1));
148 148
     }
149 149
 
150
-    private function createNotification(array $properties = []) : Notification
150
+    private function createNotification(array $properties = [ ]) : Notification
151 151
     {
152 152
         $data = [
153 153
             'user_id' => 1,
Please login to merge, or discard this patch.
Repositories/Cache/CacheNotificationDecorator.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,11 +21,11 @@  discard block
 block discarded – undo
21 21
     public function latestForUser($userId)
22 22
     {
23 23
         return $this->cache
24
-            ->tags([$this->entityName, 'global'])
24
+            ->tags([ $this->entityName, 'global' ])
25 25
             ->remember(
26 26
                 "{$this->locale}.{$this->entityName}.latestForUser.{$userId}",
27 27
                 $this->cacheTime,
28
-                function () use ($userId) {
28
+                function() use ($userId) {
29 29
                     return $this->repository->latestForUser($userId);
30 30
                 }
31 31
             );
@@ -51,11 +51,11 @@  discard block
 block discarded – undo
51 51
     public function allForUser($userId)
52 52
     {
53 53
         return $this->cache
54
-            ->tags([$this->entityName, 'global'])
54
+            ->tags([ $this->entityName, 'global' ])
55 55
             ->remember(
56 56
                 "{$this->locale}.{$this->entityName}.allForUser.{$userId}",
57 57
                 $this->cacheTime,
58
-                function () use ($userId) {
58
+                function() use ($userId) {
59 59
                     return $this->repository->allForUser($userId);
60 60
                 }
61 61
             );
@@ -69,11 +69,11 @@  discard block
 block discarded – undo
69 69
     public function allReadForUser($userId)
70 70
     {
71 71
         return $this->cache
72
-            ->tags([$this->entityName, 'global'])
72
+            ->tags([ $this->entityName, 'global' ])
73 73
             ->remember(
74 74
                 "{$this->locale}.{$this->entityName}.allReadForUser.{$userId}",
75 75
                 $this->cacheTime,
76
-                function () use ($userId) {
76
+                function() use ($userId) {
77 77
                     return $this->repository->allReadForUser($userId);
78 78
                 }
79 79
             );
@@ -87,11 +87,11 @@  discard block
 block discarded – undo
87 87
     public function allUnreadForUser($userId)
88 88
     {
89 89
         return $this->cache
90
-            ->tags([$this->entityName, 'global'])
90
+            ->tags([ $this->entityName, 'global' ])
91 91
             ->remember(
92 92
                 "{$this->locale}.{$this->entityName}.allUnreadForUser.{$userId}",
93 93
                 $this->cacheTime,
94
-                function () use ($userId) {
94
+                function() use ($userId) {
95 95
                     return $this->repository->allUnreadForUser($userId);
96 96
                 }
97 97
             );
Please login to merge, or discard this patch.
Entities/Notification.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@
 block discarded – undo
18 18
 class Notification extends Model
19 19
 {
20 20
     protected $table = 'notification__notifications';
21
-    protected $fillable = ['user_id', 'type', 'message', 'icon_class', 'link', 'is_read', 'title'];
22
-    protected $appends = ['time_ago'];
23
-    protected $casts = ['is_read' => 'bool'];
21
+    protected $fillable = [ 'user_id', 'type', 'message', 'icon_class', 'link', 'is_read', 'title' ];
22
+    protected $appends = [ 'time_ago' ];
23
+    protected $casts = [ 'is_read' => 'bool' ];
24 24
 
25 25
     /**
26 26
      * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
Please login to merge, or discard this patch.