From 76706502cc1d861abf7489288726755606717274 Mon Sep 17 00:00:00 2001 From: Jeremy Postlethwaite Date: Thu, 15 Aug 2024 14:03:14 -0700 Subject: [PATCH] Restoring breadcrumb styling. Aligning line numbers. --- .../Html/Renderer/Template/css/style.css | 7 ++ .../Html/Renderer/Template/line.html.dist | 2 +- .../BankAccount.php.html | 68 +++++++-------- ...with_class_and_anonymous_function.php.html | 38 ++++---- .../source_with_ignore.php.html | 84 +++++++++--------- .../BankAccount.php.html | 68 +++++++-------- .../BankAccount.php_branch.html | 84 +++++++++--------- .../BankAccount.php_path.html | 86 +++++++++---------- .../source_without_namespace.php.html | 36 ++++---- .../source_without_namespace.php_branch.html | 56 ++++++------ .../source_without_namespace.php_path.html | 70 +++++++-------- 11 files changed, 303 insertions(+), 296 deletions(-) diff --git a/src/Report/Html/Renderer/Template/css/style.css b/src/Report/Html/Renderer/Template/css/style.css index 4216dfc34..896c45cfe 100644 --- a/src/Report/Html/Renderer/Template/css/style.css +++ b/src/Report/Html/Renderer/Template/css/style.css @@ -1,4 +1,5 @@ :root { + --phpunit-breadcrumbs: #e9ecef; --phpunit-success-bar: #28a745; --phpunit-success-high: {{success-high}}; --phpunit-success-medium: {{success-medium}}; @@ -18,6 +19,12 @@ body { padding-top: 10px; } +nav .breadcrumb { + border-radius: var(--bs-border-radius); + background-color: var(--phpunit-breadcrumbs); + padding: .75rem 1rem; +} + .popover { max-width: none; } diff --git a/src/Report/Html/Renderer/Template/line.html.dist b/src/Report/Html/Renderer/Template/line.html.dist index 89810d157..d7e055f63 100644 --- a/src/Report/Html/Renderer/Template/line.html.dist +++ b/src/Report/Html/Renderer/Template/line.html.dist @@ -1 +1 @@ - {{lineNumber}}{{lineContent}} + {{lineNumber}}{{lineContent}} diff --git a/tests/_files/Report/HTML/CoverageForBankAccount/BankAccount.php.html b/tests/_files/Report/HTML/CoverageForBankAccount/BankAccount.php.html index ff8c771bb..d03cee310 100644 --- a/tests/_files/Report/HTML/CoverageForBankAccount/BankAccount.php.html +++ b/tests/_files/Report/HTML/CoverageForBankAccount/BankAccount.php.html @@ -193,40 +193,40 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1<?php
2class BankAccount
3{
4    protected $balance = 0;
5
6    public function getBalance()
7    {
8        return $this->balance;
9    }
10
11    protected function setBalance($balance)
12    {
13        if ($balance >= 0) {
14            $this->balance = $balance;
15        } else {
16            throw new RuntimeException;
17        }
18    }
19
20    public function depositMoney($balance)
21    {
22        $this->setBalance($this->getBalance() + $balance);
23
24        return $this->getBalance();
25    }
26
27    public function withdrawMoney($balance)
28    {
29        $this->setBalance($this->getBalance() - $balance);
30
31        return $this->getBalance();
32        return $this->getBalance();
33    }
34}
1<?php
2class BankAccount
3{
4    protected $balance = 0;
5
6    public function getBalance()
7    {
8        return $this->balance;
9    }
10
11    protected function setBalance($balance)
12    {
13        if ($balance >= 0) {
14            $this->balance = $balance;
15        } else {
16            throw new RuntimeException;
17        }
18    }
19
20    public function depositMoney($balance)
21    {
22        $this->setBalance($this->getBalance() + $balance);
23
24        return $this->getBalance();
25    }
26
27    public function withdrawMoney($balance)
28    {
29        $this->setBalance($this->getBalance() - $balance);
30
31        return $this->getBalance();
32        return $this->getBalance();
33    }
34}
diff --git a/tests/_files/Report/HTML/CoverageForClassWithAnonymousFunction/source_with_class_and_anonymous_function.php.html b/tests/_files/Report/HTML/CoverageForClassWithAnonymousFunction/source_with_class_and_anonymous_function.php.html index dde45cba8..3d1f80d19 100644 --- a/tests/_files/Report/HTML/CoverageForClassWithAnonymousFunction/source_with_class_and_anonymous_function.php.html +++ b/tests/_files/Report/HTML/CoverageForClassWithAnonymousFunction/source_with_class_and_anonymous_function.php.html @@ -127,25 +127,25 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + +
1<?php
2
3class CoveredClassWithAnonymousFunctionInStaticMethod
4{
5    public static function runAnonymous()
6    {
7        $filter = ['abc124', 'abc123', '123'];
8
9        array_walk(
10            $filter,
11            function (&$val, $key) {
12                $val = preg_replace('|[^0-9]|', '', $val);
13            }
14        );
15
16        // Should be covered
17        $extravar = true;
18    }
19}
1<?php
2
3class CoveredClassWithAnonymousFunctionInStaticMethod
4{
5    public static function runAnonymous()
6    {
7        $filter = ['abc124', 'abc123', '123'];
8
9        array_walk(
10            $filter,
11            function (&$val, $key) {
12                $val = preg_replace('|[^0-9]|', '', $val);
13            }
14        );
15
16        // Should be covered
17        $extravar = true;
18    }
19}
diff --git a/tests/_files/Report/HTML/CoverageForFileWithIgnoredLines/source_with_ignore.php.html b/tests/_files/Report/HTML/CoverageForFileWithIgnoredLines/source_with_ignore.php.html index 27a449824..c8ed1fb11 100644 --- a/tests/_files/Report/HTML/CoverageForFileWithIgnoredLines/source_with_ignore.php.html +++ b/tests/_files/Report/HTML/CoverageForFileWithIgnoredLines/source_with_ignore.php.html @@ -135,48 +135,48 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1<?php
2if ($neverHappens) {
3    // @codeCoverageIgnoreStart
4    print '*';
5    // @codeCoverageIgnoreEnd
6}
7
8/**
9 * @codeCoverageIgnore
10 */
11class Foo
12{
13    public function bar()
14    {
15    }
16}
17
18class Bar
19{
20    /**
21     * @codeCoverageIgnore
22     */
23    public function foo()
24    {
25    }
26}
27
28function baz()
29{
30    print '*'; // @codeCoverageIgnore
31}
32
33interface Bor
34{
35    public function foo();
36}
37
38// @codeCoverageIgnoreStart
39print '
40Multiline
41';
42// @codeCoverageIgnoreEnd
1<?php
2if ($neverHappens) {
3    // @codeCoverageIgnoreStart
4    print '*';
5    // @codeCoverageIgnoreEnd
6}
7
8/**
9 * @codeCoverageIgnore
10 */
11class Foo
12{
13    public function bar()
14    {
15    }
16}
17
18class Bar
19{
20    /**
21     * @codeCoverageIgnore
22     */
23    public function foo()
24    {
25    }
26}
27
28function baz()
29{
30    print '*'; // @codeCoverageIgnore
31}
32
33interface Bor
34{
35    public function foo();
36}
37
38// @codeCoverageIgnoreStart
39print '
40Multiline
41';
42// @codeCoverageIgnoreEnd
diff --git a/tests/_files/Report/HTML/PathCoverageForBankAccount/BankAccount.php.html b/tests/_files/Report/HTML/PathCoverageForBankAccount/BankAccount.php.html index f4e87f5b5..913f95d2a 100644 --- a/tests/_files/Report/HTML/PathCoverageForBankAccount/BankAccount.php.html +++ b/tests/_files/Report/HTML/PathCoverageForBankAccount/BankAccount.php.html @@ -291,40 +291,40 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1<?php
2class BankAccount
3{
4    protected $balance = 0;
5
6    public function getBalance()
7    {
8        return $this->balance;
9    }
10
11    protected function setBalance($balance)
12    {
13        if ($balance >= 0) {
14            $this->balance = $balance;
15        } else {
16            throw new RuntimeException;
17        }
18    }
19
20    public function depositMoney($balance)
21    {
22        $this->setBalance($this->getBalance() + $balance);
23
24        return $this->getBalance();
25    }
26
27    public function withdrawMoney($balance)
28    {
29        $this->setBalance($this->getBalance() - $balance);
30
31        return $this->getBalance();
32        return $this->getBalance();
33    }
34}
1<?php
2class BankAccount
3{
4    protected $balance = 0;
5
6    public function getBalance()
7    {
8        return $this->balance;
9    }
10
11    protected function setBalance($balance)
12    {
13        if ($balance >= 0) {
14            $this->balance = $balance;
15        } else {
16            throw new RuntimeException;
17        }
18    }
19
20    public function depositMoney($balance)
21    {
22        $this->setBalance($this->getBalance() + $balance);
23
24        return $this->getBalance();
25    }
26
27    public function withdrawMoney($balance)
28    {
29        $this->setBalance($this->getBalance() - $balance);
30
31        return $this->getBalance();
32        return $this->getBalance();
33    }
34}
diff --git a/tests/_files/Report/HTML/PathCoverageForBankAccount/BankAccount.php_branch.html b/tests/_files/Report/HTML/PathCoverageForBankAccount/BankAccount.php_branch.html index 6ed0e1760..316a6bbe6 100644 --- a/tests/_files/Report/HTML/PathCoverageForBankAccount/BankAccount.php_branch.html +++ b/tests/_files/Report/HTML/PathCoverageForBankAccount/BankAccount.php_branch.html @@ -291,7 +291,7 @@ - + @@ -299,32 +299,32 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + +
1%s
1%s
2%s
3%s
4%s
6%s
7%s
8%s
9%s
9%s
10
11%s
12%s
13%s
14%s
15%s
16%s
17%s
18%s
19
20%s
21%s
22%s
23
24%s
25%s
26
27%s
28%s
29%s
30
31%s
32        return $this->getBalance();
33    }
34}
11%s
12%s
13%s
14%s
15%s
16%s
17%s
18%s
19
20%s
21%s
22%s
23
24%s
25%s
26
27%s
28%s
29%s
30
31%s
32        return $this->getBalance();
33    }
34}
@@ -342,10 +342,10 @@
BankAccount 20%s 21%s - 22%s + 22%s 23 24%s - 25%s + 25%s @@ -353,8 +353,8 @@
BankAccount-> - - + + @@ -362,39 +362,39 @@
BankAccount->
BankAccount->setBalance
6%s
7%s
8%s
7%s
8%s
9%s
- - - + + +
11%s
12%s
13%s
11%s
12%s
13%s
- +
14%s
14%s
- +
16%s
16%s
- +
18%s
18%s
BankAccount->withdrawMoney
- - - - - - + + + + + +
27%s
28%s
29%s
30
31%s
32%s
27%s
28%s
29%s
30
31%s
32%s
diff --git a/tests/_files/Report/HTML/PathCoverageForBankAccount/BankAccount.php_path.html b/tests/_files/Report/HTML/PathCoverageForBankAccount/BankAccount.php_path.html index f18856cba..c5e1d0f01 100644 --- a/tests/_files/Report/HTML/PathCoverageForBankAccount/BankAccount.php_path.html +++ b/tests/_files/Report/HTML/PathCoverageForBankAccount/BankAccount.php_path.html @@ -291,40 +291,40 @@ - + 2 - + - - - - - - - - - + + + + + + + + + - + - - + + - - + + - - - - - - - - - + + + + + + + + +
1%s
1%s
%s
3%s
4%s
5
5
6%s
7%s
8%s
9%s
10
11%s
12%s
13%s
14%s
15%s
7%s
8%s
9%s
10
11%s
12%s
13%s
14%s
15%s
16%s
17%s
17%s
18%s
19
20%s
19
20%s
21%s
22%s
23
22%s
23
24%s
25%s
26
27%s
28%s
29%s
30
31%s
32%s
33    }
34}
26
27%s
28%s
29%s
30
31%s
32%s
33    }
34}
@@ -340,29 +340,29 @@

Paths

BankAccount->depositMoney
- - - - - - + + + + + +
20%s
21%s
22%s
23
24%s
25%s
20%s
21%s
22%s
23
24%s
25%s
BankAccount->getBalance
- - - - + + + +
6%s
7%s
8%s
9%s
6%s
7%s
8%s
9%s
BankAccount->setBalance
- + @@ -375,7 +375,7 @@
BankAccount->
11%s
11%s
12%s
13%s
 
- + @@ -385,12 +385,12 @@
BankAccount->
BankAccount->withdrawMoney
11%s
12%s
12%s
13%s
 
16%s
- - - - - - + + + + + +
27%s
28%s
29%s
30
31%s
32%s
27%s
28%s
29%s
30
31%s
32%s
diff --git a/tests/_files/Report/HTML/PathCoverageForSourceWithoutNamespace/source_without_namespace.php.html b/tests/_files/Report/HTML/PathCoverageForSourceWithoutNamespace/source_without_namespace.php.html index c94f823ac..1446f796d 100644 --- a/tests/_files/Report/HTML/PathCoverageForSourceWithoutNamespace/source_without_namespace.php.html +++ b/tests/_files/Report/HTML/PathCoverageForSourceWithoutNamespace/source_without_namespace.php.html @@ -147,24 +147,24 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + +
1<?php
2/**
3 * Represents foo.
4 */
5class Foo
6{
7}
8
9/**
10 * @param mixed $bar
11 */
12function &foo($bar)
13{
14    $baz = function () {};
15    $a   = true ? true : false;
16    $b   = "{$a}";
17    $c   = "${b}";
18}
1<?php
2/**
3 * Represents foo.
4 */
5class Foo
6{
7}
8
9/**
10 * @param mixed $bar
11 */
12function &foo($bar)
13{
14    $baz = function () {};
15    $a   = true ? true : false;
16    $b   = "{$a}";
17    $c   = "${b}";
18}
diff --git a/tests/_files/Report/HTML/PathCoverageForSourceWithoutNamespace/source_without_namespace.php_branch.html b/tests/_files/Report/HTML/PathCoverageForSourceWithoutNamespace/source_without_namespace.php_branch.html index 7c29d3502..590d2010b 100644 --- a/tests/_files/Report/HTML/PathCoverageForSourceWithoutNamespace/source_without_namespace.php_branch.html +++ b/tests/_files/Report/HTML/PathCoverageForSourceWithoutNamespace/source_without_namespace.php_branch.html @@ -147,24 +147,24 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + +
1<?php
2/**
3 * Represents foo.
4 */
5class Foo
6{
7}
8
9/**
10 * @param mixed $bar
11 */
12function &foo($bar)
13{
14    $baz = function () {};
15    $a   = true ? true : false;
16    $b   = "{$a}";
17    $c   = "${b}";
18}
1<?php
2/**
3 * Represents foo.
4 */
5class Foo
6{
7}
8
9/**
10 * @param mixed $bar
11 */
12function &foo($bar)
13{
14    $baz = function () {};
15    $a   = true ? true : false;
16    $b   = "{$a}";
17    $c   = "${b}";
18}
@@ -180,37 +180,37 @@

Branches

foo
- - - - + + + +
12function &foo($bar)
13{
14    $baz = function () {};
15    $a   = true ? true : false;
12function &foo($bar)
13{
14    $baz = function () {};
15    $a   = true ? true : false;
- +
15    $a   = true ? true : false;
15    $a   = true ? true : false;
- +
15    $a   = true ? true : false;
15    $a   = true ? true : false;
- - - + + +
15    $a   = true ? true : false;
16    $b   = "{$a}";
17    $c   = "${b}";
15    $a   = true ? true : false;
16    $b   = "{$a}";
17    $c   = "${b}";
{closure:%ssource_without_namespace.php:14-14}
- +
14    $baz = function () {};
14    $baz = function () {};
diff --git a/tests/_files/Report/HTML/PathCoverageForSourceWithoutNamespace/source_without_namespace.php_path.html b/tests/_files/Report/HTML/PathCoverageForSourceWithoutNamespace/source_without_namespace.php_path.html index f7327b9ce..640b60b1f 100644 --- a/tests/_files/Report/HTML/PathCoverageForSourceWithoutNamespace/source_without_namespace.php_path.html +++ b/tests/_files/Report/HTML/PathCoverageForSourceWithoutNamespace/source_without_namespace.php_path.html @@ -147,24 +147,24 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + +
1<?php
2/**
3 * Represents foo.
4 */
5class Foo
6{
7}
8
9/**
10 * @param mixed $bar
11 */
12function &foo($bar)
13{
14    $baz = function () {};
15    $a   = true ? true : false;
16    $b   = "{$a}";
17    $c   = "${b}";
18}
1<?php
2/**
3 * Represents foo.
4 */
5class Foo
6{
7}
8
9/**
10 * @param mixed $bar
11 */
12function &foo($bar)
13{
14    $baz = function () {};
15    $a   = true ? true : false;
16    $b   = "{$a}";
17    $c   = "${b}";
18}
@@ -180,38 +180,38 @@

Paths

foo
- - - - + + + + - + - - - + + +
12function &foo($bar)
13{
14    $baz = function () {};
15    $a   = true ? true : false;
12function &foo($bar)
13{
14    $baz = function () {};
15    $a   = true ? true : false;
 
15    $a   = true ? true : false;
15    $a   = true ? true : false;
 
15    $a   = true ? true : false;
16    $b   = "{$a}";
17    $c   = "${b}";
15    $a   = true ? true : false;
16    $b   = "{$a}";
17    $c   = "${b}";
- - - - + + + + - + - - - + + +
12function &foo($bar)
13{
14    $baz = function () {};
15    $a   = true ? true : false;
12function &foo($bar)
13{
14    $baz = function () {};
15    $a   = true ? true : false;
 
15    $a   = true ? true : false;
15    $a   = true ? true : false;
 
15    $a   = true ? true : false;
16    $b   = "{$a}";
17    $c   = "${b}";
15    $a   = true ? true : false;
16    $b   = "{$a}";
17    $c   = "${b}";
{closure:%ssource_without_namespace.php:14-14}
- +
14    $baz = function () {};
14    $baz = function () {};