Completed
Push — master ( b211f5...44c82e )
by Nils
02:04
created
src/Rules/Json/JsonSchema/JsonSchemaRule.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,6 @@
 block discarded – undo
4 4
 
5 5
 use JsonSchema\Validator;
6 6
 use Psr\Http\Message\ResponseInterface;
7
-use whm\Smoke\Http\Response;
8 7
 use whm\Smoke\Rules\StandardRule;
9 8
 use whm\Smoke\Rules\ValidationFailedException;
10 9
 
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
 
34 34
     protected function doValidation(ResponseInterface $response)
35 35
     {
36
-        $data = json_decode((string)$response->getBody());
36
+        $data = json_decode((string) $response->getBody());
37 37
         if ($data === null) {
38
-            throw new ValidationFailedException("The given JSON data can not be validated (last error: '" . $this->json_errors[json_last_error()] . "').");
38
+            throw new ValidationFailedException("The given JSON data can not be validated (last error: '".$this->json_errors[json_last_error()]."').");
39 39
         } else {
40 40
             $errorStatus = false;
41 41
             $messageParts = array();
@@ -51,14 +51,14 @@  discard block
 block discarded – undo
51 51
                     $errorStatus = true;
52 52
                     $errorMessage = '';
53 53
                     foreach ($validator->getErrors() as $error) {
54
-                        $errorMessage = $errorMessage . sprintf("[%s] %s\n", $error['property'], $error['message']);
54
+                        $errorMessage = $errorMessage.sprintf("[%s] %s\n", $error['property'], $error['message']);
55 55
                     }
56
-                    $messageParts[] = $jsonSchemaFile['jsonfilename'] . ' - ' . $jsonSchemaFile['jsonfileurl'] . '(last error: ' . $errorMessage . ').';
56
+                    $messageParts[] = $jsonSchemaFile['jsonfilename'].' - '.$jsonSchemaFile['jsonfileurl'].'(last error: '.$errorMessage.').';
57 57
                 }
58 58
             }
59 59
 
60 60
             if ($errorStatus === true) {
61
-                $message = 'JSON file (' . (string) $response->getUri() . ')  does not validate against the following JSON Schema files: ' . implode(', ', $messageParts);
61
+                $message = 'JSON file ('.(string) $response->getUri().')  does not validate against the following JSON Schema files: '.implode(', ', $messageParts);
62 62
                 throw new ValidationFailedException($message);
63 63
             }
64 64
         }
Please login to merge, or discard this patch.
src/Rules/Security/PasswordSecureTransferRule.php 2 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,6 @@
 block discarded – undo
4 4
 
5 5
 use Psr\Http\Message\ResponseInterface;
6 6
 use Symfony\Component\DomCrawler\Crawler;
7
-use whm\Smoke\Http\Response;
8
-use whm\Smoke\Rules\Rule;
9 7
 use whm\Smoke\Rules\StandardRule;
10 8
 
11 9
 /**
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
 
20 20
     protected function doValidation(ResponseInterface $response)
21 21
     {
22
-        $crawler = new Crawler((string)$response->getBody());
22
+        $crawler = new Crawler((string) $response->getBody());
23 23
         $actionNodes = $crawler->filterXPath('//form[//input[@type="password"]]');
24 24
 
25
-        $url = (string)$response->getUri();
25
+        $url = (string) $response->getUri();
26 26
 
27 27
         foreach ($actionNodes as $node) {
28 28
             $action = $node->getAttribute('action');
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
             while ($parent = $parent->parentNode) {
38 38
                 if (property_exists($parent, 'tagName')) {
39
-                    $fullPath = $parent->tagName . '/' . $fullPath;
39
+                    $fullPath = $parent->tagName.'/'.$fullPath;
40 40
                 } else {
41 41
                     break;
42 42
                 }
Please login to merge, or discard this patch.
src/Rules/Seo/PageSpeedRule.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
3 3
 namespace whm\Smoke\Rules\Seo;
4 4
 
5 5
 use Psr\Http\Message\ResponseInterface;
6
-use whm\Smoke\Http\Response;
7 6
 use whm\Smoke\Rules\Rule;
8 7
 use whm\Smoke\Rules\ValidationFailedException;
9 8
 
Please login to merge, or discard this patch.
src/Rules/Seo/RobotsDisallowAllRule.php 2 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,6 @@
 block discarded – undo
4 4
 
5 5
 use Ivory\HttpAdapter\HttpAdapterInterface;
6 6
 use Psr\Http\Message\ResponseInterface;
7
-use whm\Smoke\Http\ClientAware;
8
-use whm\Smoke\Http\Response;
9 7
 use whm\Smoke\Rules\Rule;
10 8
 use whm\Smoke\Rules\ValidationFailedException;
11 9
 
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
 
22 22
     public function validate(ResponseInterface $response)
23 23
     {
24
-        $url = $response->getUri()->getScheme() . '://' . $response->getUri()->getHost();
24
+        $url = $response->getUri()->getScheme().'://'.$response->getUri()->getHost();
25 25
 
26 26
         if (substr_count($url, '/') === 2) {
27
-            $filename = $robotsUrl = $url . '/robots.txt';
27
+            $filename = $robotsUrl = $url.'/robots.txt';
28 28
         } elseif (substr_count($url, '/') === 3) {
29
-            $filename = $robotsUrl = $url . 'robots.txt';
29
+            $filename = $robotsUrl = $url.'robots.txt';
30 30
         } else {
31 31
             return;
32 32
         }
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
         $normalizedContent = $this->normalizeContent($content);
41 41
 
42
-        if (strpos($normalizedContent, 'user-agent:* disallow:/' . PHP_EOL) !== false) {
42
+        if (strpos($normalizedContent, 'user-agent:* disallow:/'.PHP_EOL) !== false) {
43 43
             throw new ValidationFailedException('The robots.txt contains disallow all (Disallow: /)');
44 44
         }
45 45
 
Please login to merge, or discard this patch.
src/Extensions/SmokeReporter/Reporter/XUnitReporter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         $failures = 0;
60 60
 
61 61
         if ($this->retriever instanceof CrawlingRetriever) {
62
-            $startPage = (string)$this->retriever->getStartPage();
62
+            $startPage = (string) $this->retriever->getStartPage();
63 63
         } else {
64 64
             $startPage = '';
65 65
         }
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
                     $testCase->addFailure(new Failure($ruleName, $message));
81 81
 
82 82
                     if ($this->retriever instanceof CrawlingRetriever) {
83
-                        $stackTrace = $result->getUrl() . ' coming from ' . (string)$this->retriever->getComingFrom($result->getUrl()) . PHP_EOL;
84
-                        $stackTrace .= '    - ' . $message . " [rule: $ruleName]";
83
+                        $stackTrace = $result->getUrl().' coming from '.(string) $this->retriever->getComingFrom($result->getUrl()).PHP_EOL;
84
+                        $stackTrace .= '    - '.$message." [rule: $ruleName]";
85 85
                         $testCase->setSystemOut($stackTrace);
86 86
                     }
87 87
                 }
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
         file_put_contents($this->filename, $xUnitReport->toXml());
94 94
 
95
-        $this->output->writeln('    <info>Writing XUnit Output to file:</info> ' . $this->filename);
95
+        $this->output->writeln('    <info>Writing XUnit Output to file:</info> '.$this->filename);
96 96
     }
97 97
 
98 98
     public function processResults($results)
Please login to merge, or discard this patch.
src/Rules/Http/Header/GZipRule.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
         if ($response instanceof ContentTypeAwareResponse) {
25 25
             if (strpos($response->getContentType(), 'image') === false
26 26
                 && strpos($response->getContentType(), 'pdf') === false
27
-                && strlen((string)$response->getBody()) >= $this->minFileSize
27
+                && strlen((string) $response->getBody()) >= $this->minFileSize
28 28
             ) {
29 29
                 if (!$response->hasHeader('Content-Encoding') || $response->getHeader('Content-Encoding')[0] !== 'gzip') {
30 30
                     throw new ValidationFailedException('gzip compression not active');
Please login to merge, or discard this patch.
src/Rules/Http/Header/SuccessStatusRule.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
     public function validate(ResponseInterface $response)
23 23
     {
24 24
         if ($response->getStatusCode() > $this->maxStatusCode) {
25
-            throw new ValidationFailedException('Status code ' . $response->getStatusCode() . ' found.');
25
+            throw new ValidationFailedException('Status code '.$response->getStatusCode().' found.');
26 26
         }
27 27
     }
28 28
 }
Please login to merge, or discard this patch.
src/Rules/Http/Header/HttpStatusRule.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
     public function validate(ResponseInterface $response)
27 27
     {
28 28
         if ($response->getStatusCode() !== $this->expectedStatus) {
29
-            throw new ValidationFailedException('Status code ' . $response->getStatusCode() . ' found, ' . $this->expectedStatus . ' expected.');
29
+            throw new ValidationFailedException('Status code '.$response->getStatusCode().' found, '.$this->expectedStatus.' expected.');
30 30
         }
31 31
     }
32 32
 }
Please login to merge, or discard this patch.
src/Rules/Http/DurationRule.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,14 +29,14 @@
 block discarded – undo
29 29
             if ($response->getDuration() > $this->maxDuration) {
30 30
                 return new CheckResult(
31 31
                     CheckResult::STATUS_FAILURE,
32
-                    'The http request took ' . (int)$response->getDuration() . ' milliseconds (limit was ' . $this->maxDuration . 'ms).',
33
-                    (int)$response->getDuration());
32
+                    'The http request took '.(int) $response->getDuration().' milliseconds (limit was '.$this->maxDuration.'ms).',
33
+                    (int) $response->getDuration());
34 34
             }
35 35
 
36 36
             return new CheckResult(
37 37
                 CheckResult::STATUS_SUCCESS,
38
-                'The http request took ' . (int)$response->getDuration() . ' milliseconds.',
39
-                (int)$response->getDuration());
38
+                'The http request took '.(int) $response->getDuration().' milliseconds.',
39
+                (int) $response->getDuration());
40 40
         }
41 41
     }
42 42
 }
Please login to merge, or discard this patch.