Passed
Pull Request — master (#1)
by Max
07:34 queued 02:12
created
tests/Type/ValidatedFieldDefinition/ListOfInputObjectValidationTest.php 2 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -100,13 +100,13 @@  discard block
 block discarded – undo
100 100
                             'args' => [
101 101
                                 'bookAttributes' => [
102 102
                                     'type' => Type::listOf($this->bookAttributesInputType),
103
-	                                'validate' => static function($var) {
104
-                        	            return $var ? 0: 1;
105
-	                                },
106
-	                                'validateItem' => static function($book) {
107
-                        	            $res = isset($book['author']) || isset($book['title']) ? 0: 1;
108
-                        	            return $res;
109
-	                                }
103
+                                    'validate' => static function($var) {
104
+                                        return $var ? 0: 1;
105
+                                    },
106
+                                    'validateItem' => static function($book) {
107
+                                        $res = isset($book['author']) || isset($book['title']) ? 0: 1;
108
+                                        return $res;
109
+                                    }
110 110
                                 ],
111 111
                             ],
112 112
                             'resolve' => static function ($value) : bool {
@@ -162,30 +162,30 @@  discard block
 block discarded – undo
162 162
             ]
163 163
         );
164 164
 
165
-	    static::assertEmpty($res->errors);
165
+        static::assertEmpty($res->errors);
166 166
 
167 167
         static::assertEquals(
168
-	        array (
169
-		        'valid' => false,
170
-		        'result' => NULL,
171
-		        'suberrors' =>
172
-			        array (
173
-				        'bookAttributes' =>
174
-					        array (
175
-						        'code' => NULL,
176
-						        'msg' => NULL,
177
-						        'suberrors' =>
178
-							        array (
179
-								        'code' => 1,
180
-								        'msg' => '',
181
-								        'path' =>
182
-									        array (
183
-										        0 => 1,
184
-									        ),
185
-							        ),
186
-					        ),
187
-			        ),
188
-	        ),
168
+            array (
169
+                'valid' => false,
170
+                'result' => NULL,
171
+                'suberrors' =>
172
+                    array (
173
+                        'bookAttributes' =>
174
+                            array (
175
+                                'code' => NULL,
176
+                                'msg' => NULL,
177
+                                'suberrors' =>
178
+                                    array (
179
+                                        'code' => 1,
180
+                                        'msg' => '',
181
+                                        'path' =>
182
+                                            array (
183
+                                                0 => 1,
184
+                                            ),
185
+                                    ),
186
+                            ),
187
+                    ),
188
+            ),
189 189
             $res->data['updateBooks']
190 190
         );
191 191
 
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
                 'title' => [
63 63
                     'type' => Type::string(),
64 64
                     'description' => 'Enter a book title, no more than 10 characters in length',
65
-                    'validate' => static function (string $title) {
65
+                    'validate' => static function(string $title) {
66 66
                         if (strlen($title) > 10) {
67 67
                             return [1, 'book title must be less than 10 chaacters'];
68 68
                         }
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
                         'unknownAuthor',
77 77
                         'authorDeceased',
78 78
                     ],
79
-                    'validate' => function (string $authorId) {
80
-                        if (! isset($this->data['people'][$authorId])) {
79
+                    'validate' => function(string $authorId) {
80
+                        if (!isset($this->data['people'][$authorId])) {
81 81
                             return ['unknownAuthor', 'We have no record of that author'];
82 82
                         }
83 83
                         return 0;
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
             'query' => $this->query,
93 93
             'mutation' => new ObjectType([
94 94
                 'name' => 'Mutation',
95
-                'fields' => function () {
95
+                'fields' => function() {
96 96
                     return [
97 97
                         'updateBooks' => new ValidatedFieldDefinition([
98 98
                             'name' => 'updateBooks',
@@ -101,15 +101,15 @@  discard block
 block discarded – undo
101 101
                                 'bookAttributes' => [
102 102
                                     'type' => Type::listOf($this->bookAttributesInputType),
103 103
 	                                'validate' => static function($var) {
104
-                        	            return $var ? 0: 1;
104
+                        	            return $var ? 0 : 1;
105 105
 	                                },
106 106
 	                                'validateItem' => static function($book) {
107
-                        	            $res = isset($book['author']) || isset($book['title']) ? 0: 1;
107
+                        	            $res = isset($book['author']) || isset($book['title']) ? 0 : 1;
108 108
                         	            return $res;
109 109
 	                                }
110 110
                                 ],
111 111
                             ],
112
-                            'resolve' => static function ($value) : bool {
112
+                            'resolve' => static function($value) : bool {
113 113
                                 return !!$value;
114 114
                             },
115 115
                         ]),
@@ -165,21 +165,21 @@  discard block
 block discarded – undo
165 165
 	    static::assertEmpty($res->errors);
166 166
 
167 167
         static::assertEquals(
168
-	        array (
168
+	        array(
169 169
 		        'valid' => false,
170 170
 		        'result' => NULL,
171 171
 		        'suberrors' =>
172
-			        array (
172
+			        array(
173 173
 				        'bookAttributes' =>
174
-					        array (
174
+					        array(
175 175
 						        'code' => NULL,
176 176
 						        'msg' => NULL,
177 177
 						        'suberrors' =>
178
-							        array (
178
+							        array(
179 179
 								        'code' => 1,
180 180
 								        'msg' => '',
181 181
 								        'path' =>
182
-									        array (
182
+									        array(
183 183
 										        0 => 1,
184 184
 									        ),
185 185
 							        ),
Please login to merge, or discard this patch.
tests/Type/ValidatedFieldDefinition/BasicTest.php 2 patches
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -9,46 +9,46 @@
 block discarded – undo
9 9
 
10 10
 final class BasicTest extends TestCase
11 11
 {
12
-	public function testInferName()
13
-	{
14
-		$def = new NamelessDef([
15
-			'type' => Type::boolean(),
16
-			'args' => [
17
-				'bookId' => [
18
-					'type' => Type::id(),
19
-					'errorCodes' => ['bookNotFound'],
20
-					'validate' => function ($bookId) {
21
-						return $bookId ? 0 : 1;
22
-					},
23
-				],
24
-			],
25
-			'resolve' => static function ($value) : bool {
26
-				return !!$value;
27
-			},
28
-		]);
12
+    public function testInferName()
13
+    {
14
+        $def = new NamelessDef([
15
+            'type' => Type::boolean(),
16
+            'args' => [
17
+                'bookId' => [
18
+                    'type' => Type::id(),
19
+                    'errorCodes' => ['bookNotFound'],
20
+                    'validate' => function ($bookId) {
21
+                        return $bookId ? 0 : 1;
22
+                    },
23
+                ],
24
+            ],
25
+            'resolve' => static function ($value) : bool {
26
+                return !!$value;
27
+            },
28
+        ]);
29 29
 
30
-		static::assertEquals("namelessDef", $def->name);
31
-	}
30
+        static::assertEquals("namelessDef", $def->name);
31
+    }
32 32
 
33
-	public function testInferNameNameAlreadyExists()
34
-	{
35
-		$def = new NamelessDef([
36
-			'name' => "FooDef",
37
-			'type' => Type::boolean(),
38
-			'args' => [
39
-				'bookId' => [
40
-					'type' => Type::id(),
41
-					'errorCodes' => ['bookNotFound'],
42
-					'validate' => function ($bookId) {
43
-						return $bookId ? 0 : 1;
44
-					},
45
-				],
46
-			],
47
-			'resolve' => static function ($value) : bool {
48
-				return !!$value;
49
-			},
50
-		]);
33
+    public function testInferNameNameAlreadyExists()
34
+    {
35
+        $def = new NamelessDef([
36
+            'name' => "FooDef",
37
+            'type' => Type::boolean(),
38
+            'args' => [
39
+                'bookId' => [
40
+                    'type' => Type::id(),
41
+                    'errorCodes' => ['bookNotFound'],
42
+                    'validate' => function ($bookId) {
43
+                        return $bookId ? 0 : 1;
44
+                    },
45
+                ],
46
+            ],
47
+            'resolve' => static function ($value) : bool {
48
+                return !!$value;
49
+            },
50
+        ]);
51 51
 
52
-		static::assertEquals("FooDef", $def->name);
53
-	}
52
+        static::assertEquals("FooDef", $def->name);
53
+    }
54 54
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,12 +17,12 @@  discard block
 block discarded – undo
17 17
 				'bookId' => [
18 18
 					'type' => Type::id(),
19 19
 					'errorCodes' => ['bookNotFound'],
20
-					'validate' => function ($bookId) {
20
+					'validate' => function($bookId) {
21 21
 						return $bookId ? 0 : 1;
22 22
 					},
23 23
 				],
24 24
 			],
25
-			'resolve' => static function ($value) : bool {
25
+			'resolve' => static function($value) : bool {
26 26
 				return !!$value;
27 27
 			},
28 28
 		]);
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
 				'bookId' => [
40 40
 					'type' => Type::id(),
41 41
 					'errorCodes' => ['bookNotFound'],
42
-					'validate' => function ($bookId) {
42
+					'validate' => function($bookId) {
43 43
 						return $bookId ? 0 : 1;
44 44
 					},
45 45
 				],
46 46
 			],
47
-			'resolve' => static function ($value) : bool {
47
+			'resolve' => static function($value) : bool {
48 48
 				return !!$value;
49 49
 			},
50 50
 		]);
Please login to merge, or discard this patch.
tests/Type/ErrorCodeTypeGenerationTest.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     {
20 20
         $types = [];
21 21
         new UserErrorsType([
22
-        	'validate' => static function($val) { return $val ? 0 : 1; },
22
+            'validate' => static function($val) { return $val ? 0 : 1; },
23 23
             'errorCodes' => [
24 24
                 'unknownUser',
25 25
                 'userIsMinor',
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
                 'name' => 'bookInput',
80 80
                 'fields' => [
81 81
                     'authorId' => [
82
-	                    'validate' => static function($authorId) { return $authorId ? 0 : 1; },
82
+                        'validate' => static function($authorId) { return $authorId ? 0 : 1; },
83 83
                         'errorCodes' => ['unknownAuthor'],
84 84
                         'type' => Type::id(),
85 85
                         'description' => 'An author Id',
Please login to merge, or discard this patch.