Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 38adb0a

Browse files
Brought tests to green.
1 parent 15bccaa commit 38adb0a

File tree

5 files changed

+63
-15
lines changed

5 files changed

+63
-15
lines changed

‎.github/workflows/laravel.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
fail-fast: true
1616
matrix:
17-
php: [8.2, 8.1]
17+
php: [8.3, 8.2, 8.1]
1818

1919
name: PHP ${{ matrix.php }}
2020

‎src/Traits/Caching.php‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function applyScopes()
4141
if ($this->scopesAreApplied) {
4242
return $this;
4343
}
44-
44+
4545
return parent::applyScopes();
4646
}
4747

@@ -170,7 +170,7 @@ protected function makeCacheKey(
170170
?? Container::getInstance()
171171
->make("db")
172172
->query();
173-
173+
174174
if (
175175
$this->query
176176
&& method_exists($this->query, "getQuery")
@@ -263,7 +263,7 @@ protected function checkCooldownAndRemoveIfExpired(Model $instance)
263263

264264
protected function checkCooldownAndFlushAfterPersisting(Model $instance, string $relationship = "")
265265
{
266-
if (!$this->isCachable()) {
266+
if (!$this->isCachable()) {
267267
return;
268268
}
269269

@@ -299,6 +299,7 @@ public function isCachable() : bool
299299
$isCacheDisabled = ! Container::getInstance()
300300
->make("config")
301301
->get("laravel-model-caching.enabled");
302+
302303
if ($isCacheDisabled) {
303304
return false;
304305
}
@@ -319,7 +320,7 @@ public function isCachable() : bool
319320
) {
320321
return $carry;
321322
}
322-
323+
323324
$relatedModel = $this->model->$related()->getRelated();
324325

325326
if (

‎tests/CreatesApplication.php‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,18 +139,26 @@ protected function getEnvironmentSetUp($app)
139139
]);
140140
}
141141

142-
public function appVersionEightAndUp(): bool
142+
public function appVersionEightAndNine(): bool
143143
{
144-
return version_compare(app()->version(), '8.0.0', '>=');
144+
return version_compare(app()->version(), '8.0.0', '>=')
145+
&& version_compare(app()->version(), '10.0.0', '<');
145146
}
146147

147148
public function appVersionFiveBetweenSeven(): bool
148149
{
149-
return version_compare(app()->version(), '5.6.0', '>=') && version_compare(app()->version(), '8.0.0', '<');
150+
return version_compare(app()->version(), '5.6.0', '>=')
151+
&& version_compare(app()->version(), '8.0.0', '<');
150152
}
151153

152154
public function appVersionOld(): bool
153155
{
154-
return version_compare(app()->version(), '5.4.0', '>=') && version_compare(app()->version(), '5.6.0', '<');
156+
return version_compare(app()->version(), '5.4.0', '>=')
157+
&& version_compare(app()->version(), '5.6.0', '<');
158+
}
159+
160+
public function appVersionTen(): bool
161+
{
162+
return version_compare(app()->version(), '10.0.0', '>=');
155163
}
156164
}

‎tests/Feature/PaginationTest.php‎

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,14 @@ class PaginationTest extends FeatureTestCase
77
{
88
public function testPaginationProvidesDifferentLinksOnDifferentPages()
99
{
10+
// Checking the version start with 10.0.
11+
if ($this->appVersionTen()) {
12+
$page1ActiveLink = '<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5 dark:bg-gray-800 dark:border-gray-600">1</span>';
13+
$page2ActiveLink = '<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5 dark:bg-gray-800 dark:border-gray-600">2</span>';
14+
}
15+
1016
// Checking the version start with 8.0.
11-
if ($this->appVersionEightAndUp()) {
17+
if ($this->appVersionEightAndNine()) {
1218
$page1ActiveLink = '<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5">1</span>';
1319
$page2ActiveLink = '<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5">2</span>';
1420
}
@@ -39,8 +45,14 @@ public function testPaginationProvidesDifferentLinksOnDifferentPages()
3945

4046
public function testAdvancedPagination()
4147
{
48+
// Checking the version start with 10.0.
49+
if ($this->appVersionTen()) {
50+
$page1ActiveLink = '<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5 dark:bg-gray-800 dark:border-gray-600">1</span>';
51+
$page2ActiveLink = '<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5 dark:bg-gray-800 dark:border-gray-600">2</span>';
52+
}
53+
4254
// Checking the version start with 8.0.
43-
if ($this->appVersionEightAndUp()) {
55+
if ($this->appVersionEightAndNine()) {
4456
$page1ActiveLink = '<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5">1</span>';
4557
$page2ActiveLink = '<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5">2</span>';
4658
}
@@ -62,8 +74,14 @@ public function testAdvancedPagination()
6274

6375
public function testCustomPagination()
6476
{
77+
// Checking the version start with 10.0.
78+
if ($this->appVersionTen()) {
79+
$page1ActiveLink = '<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5 dark:bg-gray-800 dark:border-gray-600">1</span>';
80+
$page2ActiveLink = '<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5 dark:bg-gray-800 dark:border-gray-600">2</span>';
81+
}
82+
6583
// Checking the version start with 8.0.
66-
if ($this->appVersionEightAndUp()) {
84+
if ($this->appVersionEightAndNine()) {
6785
$page1ActiveLink = '<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5">1</span>';
6886
$page2ActiveLink = '<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5">2</span>';
6987
}

‎tests/Integration/CachedBuilder/PaginateTest.php‎

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,14 @@ public function testPaginationIsCached()
3636

3737
public function testPaginationReturnsCorrectLinks()
3838
{
39-
if ($this->appVersionEightAndUp()) {
39+
// Checking the version start with 10.0.
40+
if ($this->appVersionTen()) {
41+
$page1ActiveLink = '<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5 dark:bg-gray-800 dark:border-gray-600">1</span>';
42+
$page2ActiveLink = '<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5 dark:bg-gray-800 dark:border-gray-600">2</span>';
43+
$page24ActiveLink = '<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5 dark:bg-gray-800 dark:border-gray-600">24</span>';
44+
}
45+
46+
if ($this->appVersionEightAndNine()) {
4047
$page1ActiveLink = '<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5">1</span>';
4148
$page2ActiveLink = '<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5">2</span>';
4249
$page24ActiveLink = '<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5">24</span>';
@@ -71,7 +78,14 @@ public function testPaginationReturnsCorrectLinks()
7178

7279
public function testPaginationWithOptionsReturnsCorrectLinks()
7380
{
74-
if ($this->appVersionEightAndUp()) {
81+
// Checking the version start with 10.0.
82+
if ($this->appVersionTen()) {
83+
$page1ActiveLink = '<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5 dark:bg-gray-800 dark:border-gray-600">1</span>';
84+
$page2ActiveLink = '<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5 dark:bg-gray-800 dark:border-gray-600">2</span>';
85+
$page24ActiveLink = '<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5 dark:bg-gray-800 dark:border-gray-600">24</span>';
86+
}
87+
88+
if ($this->appVersionEightAndNine()) {
7589
$page1ActiveLink = '<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5">1</span>';
7690
$page2ActiveLink = '<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5">2</span>';
7791
$page24ActiveLink = '<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5">24</span>';
@@ -106,7 +120,14 @@ public function testPaginationWithOptionsReturnsCorrectLinks()
106120

107121
public function testPaginationWithCustomOptionsReturnsCorrectLinks()
108122
{
109-
if ($this->appVersionEightAndUp()) {
123+
// Checking the version start with 10.0.
124+
if ($this->appVersionTen()) {
125+
$page1ActiveLink = '<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5 dark:bg-gray-800 dark:border-gray-600">1</span>';
126+
$page2ActiveLink = '<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5 dark:bg-gray-800 dark:border-gray-600">2</span>';
127+
$page24ActiveLink = '<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5 dark:bg-gray-800 dark:border-gray-600">24</span>';
128+
}
129+
130+
if ($this->appVersionEightAndNine()) {
110131
$page1ActiveLink = '<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5">1</span>';
111132
$page2ActiveLink = '<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5">2</span>';
112133
$page24ActiveLink = '<span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5">24</span>';

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /