Skip to content

Commit b90ec18

Browse files
committed
ci: fix infection and apply rector/rector rules
1 parent 9205543 commit b90ec18

File tree

5 files changed

+49
-59
lines changed

5 files changed

+49
-59
lines changed

infection.json.dist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"report": "master"
77
}
88
},
9-
"minCoveredMsi": 55,
10-
"minMsi": 55,
9+
"minCoveredMsi": 65,
10+
"minMsi": 65,
1111
"phpUnit": {
1212
"configDir": "./"
1313
},

psalm-baseline.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,23 @@
9292
<code><![CDATA[$links['prev']]]></code>
9393
<code><![CDATA[$links['prev']]]></code>
9494
</PossiblyInvalidArrayAccess>
95+
<PossiblyUnusedMethod>
96+
<code><![CDATA[it_gets_count]]></code>
97+
<code><![CDATA[it_gets_current_page]]></code>
98+
<code><![CDATA[it_gets_first_item]]></code>
99+
<code><![CDATA[it_gets_items]]></code>
100+
<code><![CDATA[it_gets_last_item]]></code>
101+
<code><![CDATA[it_gets_last_page]]></code>
102+
<code><![CDATA[it_gets_next_page_url_when_it_exists]]></code>
103+
<code><![CDATA[it_gets_next_page_url_when_it_not_exists]]></code>
104+
<code><![CDATA[it_gets_page_name]]></code>
105+
<code><![CDATA[it_gets_per_page]]></code>
106+
<code><![CDATA[it_gets_previous_page_url_when_it_exists]]></code>
107+
<code><![CDATA[it_gets_previous_page_url_when_it_not_exists]]></code>
108+
<code><![CDATA[it_gets_total_items]]></code>
109+
<code><![CDATA[it_returns_links]]></code>
110+
<code><![CDATA[it_returns_response_headers]]></code>
111+
</PossiblyUnusedMethod>
95112
</file>
96113
<file src="tests/src/Functional/LengthAwarePaginatorTest.php">
97114
<MixedArgument>
@@ -117,6 +134,10 @@
117134
<code><![CDATA[$links['prev']]]></code>
118135
<code><![CDATA[$links['prev']]]></code>
119136
</PossiblyInvalidArrayAccess>
137+
<PossiblyUnusedMethod>
138+
<code><![CDATA[it_returns_links]]></code>
139+
<code><![CDATA[it_returns_response_headers]]></code>
140+
</PossiblyUnusedMethod>
120141
</file>
121142
<file src="tests/src/Functional/PaginatorTest.php">
122143
<MixedArgument>
@@ -134,6 +155,10 @@
134155
<code><![CDATA[$links['next']]]></code>
135156
<code><![CDATA[$links['next']]]></code>
136157
</PossiblyInvalidArrayAccess>
158+
<PossiblyUnusedMethod>
159+
<code><![CDATA[it_returns_links]]></code>
160+
<code><![CDATA[it_sets_headers]]></code>
161+
</PossiblyUnusedMethod>
137162
</file>
138163
<file src="tests/src/Functional/TestCase.php">
139164
<InvalidPropertyAssignmentValue>

tests/src/Functional/CyclePaginatorTest.php

Lines changed: 16 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace WayOfDev\Tests\Functional;
66

7+
use PHPUnit\Framework\Attributes\Test;
78
use Spiral\Pagination\Paginator as SpiralPaginator;
89
use TiagoHillebrandt\ParseLinkHeader;
910
use WayOfDev\Paginator\CyclePaginator;
@@ -17,119 +18,91 @@ final class CyclePaginatorTest extends TestCase
1718

1819
private int $perPage = 5;
1920

20-
/**
21-
* @test
22-
*/
21+
#[Test]
2322
public function it_gets_total_items(): void
2423
{
2524
self::assertEquals(34, $this->getPaginator()->total());
2625
}
2726

28-
/**
29-
* @test
30-
*/
27+
#[Test]
3128
public function it_gets_last_page(): void
3229
{
3330
self::assertEquals(7, $this->getPaginator()->lastPage());
3431
}
3532

36-
/**
37-
* @test
38-
*/
33+
#[Test]
3934
public function it_gets_next_page_url_when_it_exists(): void
4035
{
4136
self::assertEquals('/?page=3', $this->getPaginator()->nextPageUrl());
4237
}
4338

44-
/**
45-
* @test
46-
*/
39+
#[Test]
4740
public function it_gets_next_page_url_when_it_not_exists(): void
4841
{
4942
self::assertNull(
5043
$this->getPaginator(1, 200)->nextPageUrl()
5144
);
5245
}
5346

54-
/**
55-
* @test
56-
*/
47+
#[Test]
5748
public function it_gets_previous_page_url_when_it_exists(): void
5849
{
5950
self::assertEquals('/?page=1', $this->getPaginator()->previousPageUrl());
6051
}
6152

62-
/**
63-
* @test
64-
*/
53+
#[Test]
6554
public function it_gets_previous_page_url_when_it_not_exists(): void
6655
{
6756
self::assertNull(
6857
$this->getPaginator(1, 1)->previousPageUrl()
6958
);
7059
}
7160

72-
/**
73-
* @test
74-
*/
61+
#[Test]
7562
public function it_gets_items(): void
7663
{
7764
$items = array_slice($this->items, 5, 5, true);
7865

7966
self::assertEquals($items, $this->getPaginator()->items());
8067
}
8168

82-
/**
83-
* @test
84-
*/
69+
#[Test]
8570
public function it_gets_first_item(): void
8671
{
8772
self::assertEquals(6, $this->getPaginator()->firstItem());
8873
}
8974

90-
/**
91-
* @test
92-
*/
75+
#[Test]
9376
public function it_gets_last_item(): void
9477
{
9578
self::assertEquals(10, $this->getPaginator()->lastItem());
9679
}
9780

98-
/**
99-
* @test
100-
*/
81+
#[Test]
10182
public function it_gets_per_page(): void
10283
{
10384
self::assertEquals(5, $this->getPaginator()->perPage());
10485
}
10586

106-
/**
107-
* @test
108-
*/
87+
#[Test]
10988
public function it_gets_current_page(): void
11089
{
11190
self::assertEquals(2, $this->getPaginator()->currentPage());
11291
}
11392

114-
/**
115-
* @test
116-
*/
93+
#[Test]
11794
public function it_gets_page_name(): void
11895
{
11996
self::assertEquals('page', $this->getPaginator()->getPageName());
12097
}
12198

122-
/**
123-
* @test
124-
*/
99+
#[Test]
125100
public function it_gets_count(): void
126101
{
127102
self::assertEquals(5, $this->getPaginator()->count());
128103
}
129104

130-
/**
131-
* @test
132-
*/
105+
#[Test]
133106
public function it_returns_links(): void
134107
{
135108
$paginator = $this->getPaginator();
@@ -150,9 +123,7 @@ public function it_returns_links(): void
150123
self::assertEquals('3', $links['next']['page']);
151124
}
152125

153-
/**
154-
* @test
155-
*/
126+
#[Test]
156127
public function it_returns_response_headers(): void
157128
{
158129
$paginator = $this->getPaginator();

tests/src/Functional/LengthAwarePaginatorTest.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace WayOfDev\Tests\Functional;
66

77
use Illuminate\Pagination\LengthAwarePaginator as IlluminatePaginator;
8+
use PHPUnit\Framework\Attributes\Test;
89
use TiagoHillebrandt\ParseLinkHeader;
910
use WayOfDev\Paginator\LengthAwarePaginator;
1011

@@ -31,9 +32,7 @@ public function setUp(): void
3132
);
3233
}
3334

34-
/**
35-
* @test
36-
*/
35+
#[Test]
3736
public function it_returns_links(): void
3837
{
3938
$paginator = new LengthAwarePaginator($this->queryBuilderPaginator);
@@ -54,9 +53,7 @@ public function it_returns_links(): void
5453
self::assertEquals('3', $links['next']['page']);
5554
}
5655

57-
/**
58-
* @test
59-
*/
56+
#[Test]
6057
public function it_returns_response_headers(): void
6158
{
6259
$paginator = new LengthAwarePaginator($this->queryBuilderPaginator);

tests/src/Functional/PaginatorTest.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@
44

55
namespace WayOfDev\Tests\Functional;
66

7+
use PHPUnit\Framework\Attributes\Test;
78
use TiagoHillebrandt\ParseLinkHeader;
89
use WayOfDev\Paginator\Paginator;
910

1011
final class PaginatorTest extends TestCase
1112
{
1213
private int $perPage = 5;
1314

14-
/**
15-
* @test
16-
*/
15+
#[Test]
1716
public function it_sets_headers(): void
1817
{
1918
$paginator = new Paginator($this->items, 5);
@@ -28,9 +27,7 @@ public function it_sets_headers(): void
2827
$this::assertEquals($expectedHeaders, $paginator->headers());
2928
}
3029

31-
/**
32-
* @test
33-
*/
30+
#[Test]
3431
public function it_returns_links(): void
3532
{
3633
$paginator = new Paginator($this->items, $this->perPage);

0 commit comments

Comments
 (0)