Skip to content

Commit 66c0cf6

Browse files
authored
Merge pull request #47 from cidilabs/chuck/phpunit-cleanup
Composer unit test cleanup
2 parents d0d9a5b + 8605fad commit 66c0cf6

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

src/PhpAllyIssue.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
namespace CidiLabs\PhpAlly;
44

55
use DOMElement;
6-
use DOMDocument;
76

8-
class PhpAllyIssue implements \JsonSerializable {
7+
class PhpAllyIssue implements \JsonSerializable
8+
{
99
protected $ruleId;
1010
protected $element;
1111
protected $previewElement;
@@ -68,7 +68,7 @@ public function getPreview()
6868
return $this->element->ownerDocument->saveHTML($this->previewElement);
6969
}
7070

71-
public function toArray()
71+
public function toArray(): array
7272
{
7373
return [
7474
'ruleId' => $this->ruleId,
@@ -83,7 +83,7 @@ public function __toString()
8383
return \json_encode($this->toArray());
8484
}
8585

86-
public function jsonSerialize()
86+
public function jsonSerialize(): array
8787
{
8888
return $this->toArray();
8989
}

src/PhpAllyReport.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
namespace CidiLabs\PhpAlly;
44

5-
class PhpAllyReport implements \JsonSerializable {
5+
class PhpAllyReport implements \JsonSerializable
6+
{
67
protected $issues = [];
78
protected $errors = [];
89
protected $html = '';
@@ -12,7 +13,7 @@ public function __construct()
1213
{
1314
}
1415

15-
public function toArray()
16+
public function toArray(): array
1617
{
1718
return [
1819
'issues' => $this->getIssues(),
@@ -21,14 +22,14 @@ public function toArray()
2122
];
2223
}
2324

24-
public function jsonSerialize()
25+
public function jsonSerialize(): array
2526
{
2627
return $this->toArray();
2728
}
2829

2930
public function __toString()
3031
{
31-
return \json_encode($this->toArray());
32+
return \json_encode($this->toArray());
3233
}
3334

3435
public function getIssues()
@@ -66,9 +67,9 @@ public function getIssueCounts()
6667
return $this->issueCounts;
6768
}
6869

69-
public function setIssueCounts($ruleId, $issueCount, $total) {
70-
$ruleId = str_replace(['CidiLabs\\PhpAlly\\Rule\\','App\\Rule\\'], '', $ruleId);
70+
public function setIssueCounts($ruleId, $issueCount, $total)
71+
{
72+
$ruleId = str_replace(['CidiLabs\\PhpAlly\\Rule\\', 'App\\Rule\\'], '', $ruleId);
7173
$this->issueCounts[$ruleId] = array('issueCount' => $issueCount, "totalCount" => $total);
7274
}
73-
74-
}
75+
}

src/Rule/ContentTooLong.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace CidiLabs\PhpAlly\Rule;
44

5-
use CidiLabs\PhpAlly\Rule\HtmlElement;
6-
75
use DOMElement;
86

97
/**
@@ -22,6 +20,7 @@ public function check()
2220
{
2321
$pageText = '';
2422
$wordCount = 0;
23+
$this->totalTests++;
2524

2625
// Ignore html with script tags
2726
if (count($this->getAllElements('script')) === 0) {
@@ -31,7 +30,6 @@ public function check()
3130
if($text != null){
3231
$pageText = $pageText . $text;
3332
}
34-
$this->totalTests++;
3533
}
3634
$wordCount = str_word_count($pageText);
3735

0 commit comments

Comments
 (0)