Test Failed
Push — master ( aa2b1e...645d48 )
by Justin
02:11
created
db/migrations/20171020191310_add_redirects_table.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -29,10 +29,10 @@
 block discarded – undo
29 29
     {
30 30
         $table = $this->table('redirects');
31 31
         $table->addColumn('hash', 'string')
32
-              ->addColumn('redirect_to', 'text')
33
-              ->addColumn('count', 'integer', ['default' => 0])
34
-              ->addColumn('created_at', 'datetime')
35
-              ->addColumn('updated_at', 'datetime')
36
-              ->create();
32
+                ->addColumn('redirect_to', 'text')
33
+                ->addColumn('count', 'integer', ['default' => 0])
34
+                ->addColumn('created_at', 'datetime')
35
+                ->addColumn('updated_at', 'datetime')
36
+                ->create();
37 37
     }
38 38
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
         $table = $this->table('redirects');
31 31
         $table->addColumn('hash', 'string')
32 32
               ->addColumn('redirect_to', 'text')
33
-              ->addColumn('count', 'integer', ['default' => 0])
33
+              ->addColumn('count', 'integer', [ 'default' => 0 ])
34 34
               ->addColumn('created_at', 'datetime')
35 35
               ->addColumn('updated_at', 'datetime')
36 36
               ->create();
Please login to merge, or discard this patch.
app/Models/Redirect.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
      */
43 43
     public function getUrlAttribute()
44 44
     {
45
-        return config()['base_url'] . '/' . $this->hash;
45
+        return config()[ 'base_url' ] . '/' . $this->hash;
46 46
     }
47 47
 
48 48
     /**
Please login to merge, or discard this patch.
app/helpers.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
  * @param array  $data      array of variables to extract
7 7
  * @return void
8 8
  */
9
-function view($location, $data = [])
9
+function view($location, $data = [ ])
10 10
 {
11 11
     ob_start();
12 12
     extract($data);
Please login to merge, or discard this patch.
app/Middleware/Api.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     public function isAuthorized()
57 57
     {
58 58
         $auth = substr($this->request->getHeaderLine('Authorization'), 7);
59
-        return $this->request->getAttribute('config')['api_secret'] === $auth;
59
+        return $this->request->getAttribute('config')[ 'api_secret' ] === $auth;
60 60
     }
61 61
 
62 62
     /**
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
     public function create()
78 78
     {
79 79
         $body = $this->request->getAttribute('body');
80
-        if (isset($body['url'])) {
81
-            return new JsonResponse(Redirect::createUnique($body['url']));
80
+        if (isset($body[ 'url' ])) {
81
+            return new JsonResponse(Redirect::createUnique($body[ 'url' ]));
82 82
         }
83 83
         return new JsonResponse([
84 84
             'message' => 'Request must include json body with url property.'
@@ -99,10 +99,10 @@  discard block
 block discarded – undo
99 99
                 case "POST /redirects":
100 100
                     return $this->create();
101 101
                 default:
102
-                    return new JsonResponse(['status' => 'No such api endpoint'], 404);
102
+                    return new JsonResponse([ 'status' => 'No such api endpoint' ], 404);
103 103
             }
104 104
         }
105
-        return new JsonResponse(['message' => 'Not authorized'], 403);
105
+        return new JsonResponse([ 'message' => 'Not authorized' ], 403);
106 106
     }
107 107
 
108 108
     /**
Please login to merge, or discard this patch.
app/Middleware/Database.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
     public function process(ServerRequestInterface $request, DelegateInterface $delegate)
20 20
     {
21 21
         $capsule = new Manager;
22
-        $capsule->addConnection($request->getAttribute('config')['database']);
22
+        $capsule->addConnection($request->getAttribute('config')[ 'database' ]);
23 23
         $capsule->setAsGlobal();
24 24
         $capsule->bootEloquent();
25 25
         return $delegate->process($request->withAttribute('capsule', $capsule));
Please login to merge, or discard this patch.
tests/RedirectTest.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -39,15 +39,15 @@  discard block
 block discarded – undo
39 39
                 'REQUEST_METHOD' => 'GET',
40 40
                 'REQUEST_URI' => '/ghijkl'
41 41
             ],
42
-            $query = [],
43
-            $body = [],
44
-            $cookies = [],
45
-            $files = []
42
+            $query = [ ],
43
+            $body = [ ],
44
+            $cookies = [ ],
45
+            $files = [ ]
46 46
         );
47 47
 
48 48
         // Setup the database connection
49 49
         $config = config('tests/samples/config.php');
50
-        touch($config['database']['database']);
50
+        touch($config[ 'database' ][ 'database' ]);
51 51
         $delegate = new Delegate();
52 52
         $database = new Database();
53 53
         $database->process($request->withAttribute('config', $config), $delegate);
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      */
71 71
     public function tearDown(): void
72 72
     {
73
-        unlink($this->request->getAttribute('config')['database']['database']);
73
+        unlink($this->request->getAttribute('config')[ 'database' ][ 'database' ]);
74 74
     }
75 75
 
76 76
     /**
@@ -97,12 +97,12 @@  discard block
 block discarded – undo
97 97
             'INSERT INTO redirects (`hash`, `redirect_to`, `count`, `created_at`, `updated_at`)
98 98
             VALUES("abcdef", "http://example.com", 0, "2017-10-10", "2017-10-10")'
99 99
         );
100
-        $request = $this->request->withUri(new Uri(config()['base_url'] . '/abcdef'));
100
+        $request = $this->request->withUri(new Uri(config()[ 'base_url' ] . '/abcdef'));
101 101
         $delegate = new Delegate();
102 102
         $redirect = new Redirect();
103 103
         $response = $redirect->process($request, $delegate);
104 104
         $this->assertEquals(301, $response->getStatusCode());
105 105
         $this->assertEquals('http://example.com', $response->getHeaderLine('Location'));
106
-        $this->assertEquals(1, $this->db->query('SELECT `count` FROM `redirects`')->fetch(\PDO::FETCH_ASSOC)['count']);
106
+        $this->assertEquals(1, $this->db->query('SELECT `count` FROM `redirects`')->fetch(\PDO::FETCH_ASSOC)[ 'count' ]);
107 107
     }
108 108
 }
Please login to merge, or discard this patch.
tests/HelpersTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     public function testView(): void
25 25
     {
26 26
         $hash = bin2hex(openssl_random_pseudo_bytes(16));
27
-        $value = view('/../tests/samples/view.php', ['hash' => $hash]);
27
+        $value = view('/../tests/samples/view.php', [ 'hash' => $hash ]);
28 28
         $this->assertEquals('Test value: ' . $hash, $value);
29 29
     }
30 30
 
@@ -37,6 +37,6 @@  discard block
 block discarded – undo
37 37
     {
38 38
         $hash = '9575d687c61ce66fc190cd2bed464cef';
39 39
         $value = config('tests/samples/config.php');
40
-        $this->assertEquals($hash, $value['api_secret']);
40
+        $this->assertEquals($hash, $value[ 'api_secret' ]);
41 41
     }
42 42
 }
Please login to merge, or discard this patch.
tests/BodyParserTest.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -34,13 +34,13 @@  discard block
 block discarded – undo
34 34
                 'REQUEST_METHOD' => 'GET',
35 35
                 'REQUEST_URI' => '/redirects'
36 36
             ],
37
-            $query = [],
38
-            $body = [],
39
-            $cookies = [],
40
-            $files = []
37
+            $query = [ ],
38
+            $body = [ ],
39
+            $cookies = [ ],
40
+            $files = [ ]
41 41
         );
42
-        $this->request = $request->withBody(new CallbackStream(function () {
43
-            return json_encode(['hello' => 'world']);
42
+        $this->request = $request->withBody(new CallbackStream(function() {
43
+            return json_encode([ 'hello' => 'world' ]);
44 44
         }));
45 45
     }
46 46
 
@@ -55,6 +55,6 @@  discard block
 block discarded – undo
55 55
         $parser = new BodyParser();
56 56
         $parser->process($this->request, $delegate);
57 57
         $parsed = $delegate->getRequest();
58
-        $this->assertEquals(['hello' => 'world'], $parsed->getAttribute('body'));
58
+        $this->assertEquals([ 'hello' => 'world' ], $parsed->getAttribute('body'));
59 59
     }
60 60
 }
Please login to merge, or discard this patch.
tests/ApiTest.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -49,17 +49,17 @@  discard block
 block discarded – undo
49 49
                 'REQUEST_METHOD' => 'GET',
50 50
                 'REQUEST_URI' => '/redirects'
51 51
             ],
52
-            $query = [],
52
+            $query = [ ],
53 53
             $body = [
54 54
                 ''
55 55
             ],
56
-            $cookies = [],
57
-            $files = []
56
+            $cookies = [ ],
57
+            $files = [ ]
58 58
         );
59 59
         $request = $this->request->withAttribute('config', config());
60 60
 
61 61
         // Setup the database connection
62
-        touch($config['database']['database']);
62
+        touch($config[ 'database' ][ 'database' ]);
63 63
         $delegate = new Delegate();
64 64
         $database = new Database();
65 65
         $database->process($request, $delegate);
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      */
84 84
     public function tearDown(): void
85 85
     {
86
-        unlink($this->request->getAttribute('config')['database']['database']);
86
+        unlink($this->request->getAttribute('config')[ 'database' ][ 'database' ]);
87 87
     }
88 88
 
89 89
     /**
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         $request = $this->request
183 183
             ->withMethod('POST')
184 184
             ->withHeader('Authorization', 'Bearer 9575d687c61ce66fc190cd2bed464cef')
185
-            ->withAttribute('body', ['url' => 'http://example.com']);
185
+            ->withAttribute('body', [ 'url' => 'http://example.com' ]);
186 186
         $this->api->setRequest($request);
187 187
         $response = $this->api->response();
188 188
         $results = $this->db->query(
Please login to merge, or discard this patch.