diff --git a/tests/Feature/PaginationTest.php b/tests/Feature/PaginationTest.php
index d5ed5bb..7c5dbbd 100644
--- a/tests/Feature/PaginationTest.php
+++ b/tests/Feature/PaginationTest.php
@@ -2,27 +2,19 @@
use GeneaLabs\LaravelModelCaching\Tests\FeatureTestCase;
use GeneaLabs\LaravelModelCaching\Tests\Fixtures\Book;
-use Illuminate\Support\Str;
class PaginationTest extends FeatureTestCase
{
public function testPaginationProvidesDifferentLinksOnDifferentPages()
{
- if (Str::startsWith(app()->version(), "5.6")
- || Str::startsWith(app()->version(), "5.7")
- || Str::startsWith(app()->version(), "5.8")
- || Str::startsWith(app()->version(), "6.0")
- ) {
+ // Checking the version start with 5.6, 5.7, 5.8 or 6.
+ if (preg_match("/^((5\.[6-8])|(6\.))/", app()->version())) {
$page1ActiveLink = '
1';
$page2ActiveLink = '2';
}
- if (Str::startsWith(app()->version(), "5.5")) {
- $page1ActiveLink = '1';
- $page2ActiveLink = '2';
- }
-
- if (Str::startsWith(app()->version(), "5.4")) {
+ // Checking the version 5.4 and 5.5
+ if (preg_match("/^5\.[4-5]/", app()->version())) {
$page1ActiveLink = '1';
$page2ActiveLink = '2';
}
@@ -41,21 +33,12 @@ public function testPaginationProvidesDifferentLinksOnDifferentPages()
public function testAdvancedPagination()
{
- if (Str::startsWith(app()->version(), "5.6")
- || Str::startsWith(app()->version(), "5.7")
- || Str::startsWith(app()->version(), "5.8")
- || Str::startsWith(app()->version(), "6.0")
- ) {
+ if (preg_match("/^((5\.[6-8])|(6\.))/", app()->version())) {
$page1ActiveLink = '1';
$page2ActiveLink = '2';
}
- if (Str::startsWith(app()->version(), "5.5")) {
- $page1ActiveLink = '1';
- $page2ActiveLink = '2';
- }
-
- if (Str::startsWith(app()->version(), "5.4")) {
+ if (preg_match("/^5\.[4-5]/", app()->version())) {
$page1ActiveLink = '1';
$page2ActiveLink = '2';
}
@@ -67,21 +50,12 @@ public function testAdvancedPagination()
public function testCustomPagination()
{
- if (Str::startsWith(app()->version(), "5.6")
- || Str::startsWith(app()->version(), "5.7")
- || Str::startsWith(app()->version(), "5.8")
- || Str::startsWith(app()->version(), "6.0")
- ) {
+ if (preg_match("/^((5\.[6-8])|(6\.))/", app()->version())) {
$page1ActiveLink = '1';
$page2ActiveLink = '2';
}
- if (Str::startsWith(app()->version(), "5.5")) {
- $page1ActiveLink = '1';
- $page2ActiveLink = '2';
- }
-
- if (Str::startsWith(app()->version(), "5.4")) {
+ if (preg_match("/^5\.[4-5]/", app()->version())) {
$page1ActiveLink = '1';
$page2ActiveLink = '2';
}
diff --git a/tests/Integration/CachedBuilder/PaginateTest.php b/tests/Integration/CachedBuilder/PaginateTest.php
index 7df45a4..e7872e4 100644
--- a/tests/Integration/CachedBuilder/PaginateTest.php
+++ b/tests/Integration/CachedBuilder/PaginateTest.php
@@ -36,23 +36,13 @@ public function testPaginationIsCached()
public function testPaginationReturnsCorrectLinks()
{
- if (Str::startsWith(app()->version(), "5.6")
- || Str::startsWith(app()->version(), "5.7")
- || Str::startsWith(app()->version(), "5.8")
- || Str::startsWith(app()->version(), "6.0")
- ) {
+ if (preg_match("/^((5\.[6-8])|(6\.))/", app()->version())) {
$page1ActiveLink = '1';
$page2ActiveLink = '2';
$page24ActiveLink = '24';
}
- if (Str::startsWith(app()->version(), "5.5")) {
- $page1ActiveLink = '1';
- $page2ActiveLink = '2';
- $page24ActiveLink = '24';
- }
-
- if (Str::startsWith(app()->version(), "5.4")) {
+ if (preg_match("/^5\.[4-5]/", app()->version())) {
$page1ActiveLink = '1';
$page2ActiveLink = '2';
$page24ActiveLink = '24';
@@ -75,23 +65,13 @@ public function testPaginationReturnsCorrectLinks()
public function testPaginationWithOptionsReturnsCorrectLinks()
{
- if (Str::startsWith(app()->version(), "5.6")
- || Str::startsWith(app()->version(), "5.7")
- || Str::startsWith(app()->version(), "5.8")
- || Str::startsWith(app()->version(), "6.0")
- ) {
+ if (preg_match("/^((5\.[6-8])|(6\.))/", app()->version())) {
$page1ActiveLink = '1';
$page2ActiveLink = '2';
$page24ActiveLink = '24';
}
- if (Str::startsWith(app()->version(), "5.5")) {
- $page1ActiveLink = '1';
- $page2ActiveLink = '2';
- $page24ActiveLink = '24';
- }
-
- if (Str::startsWith(app()->version(), "5.4")) {
+ if (preg_match("/^5\.[4-5]/", app()->version())) {
$page1ActiveLink = '1';
$page2ActiveLink = '2';
$page24ActiveLink = '24';
@@ -114,23 +94,13 @@ public function testPaginationWithOptionsReturnsCorrectLinks()
public function testPaginationWithCustomOptionsReturnsCorrectLinks()
{
- if (Str::startsWith(app()->version(), "5.6")
- || Str::startsWith(app()->version(), "5.7")
- || Str::startsWith(app()->version(), "5.8")
- || Str::startsWith(app()->version(), "6.0")
- ) {
+ if (preg_match("/^((5\.[6-8])|(6\.))/", app()->version())) {
$page1ActiveLink = '1';
$page2ActiveLink = '2';
$page24ActiveLink = '24';
}
- if (Str::startsWith(app()->version(), "5.5")) {
- $page1ActiveLink = '1';
- $page2ActiveLink = '2';
- $page24ActiveLink = '24';
- }
-
- if (Str::startsWith(app()->version(), "5.4")) {
+ if (preg_match("/^5\.[4-5]/", app()->version())) {
$page1ActiveLink = '1';
$page2ActiveLink = '2';
$page24ActiveLink = '24';
diff --git a/tests/Integration/CachedBuilderTest.php b/tests/Integration/CachedBuilderTest.php
index 4e9f7ca..2ebe7f5 100644
--- a/tests/Integration/CachedBuilderTest.php
+++ b/tests/Integration/CachedBuilderTest.php
@@ -49,7 +49,7 @@ public function testCreatingModelClearsCache()
])
->get(sha1(
"genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor_1_2_3_4_5_6_" .
- '7_8_9_10-genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbooks'
+ "7_8_9_10-genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbooks"
));
$this->assertNull($results);
@@ -67,7 +67,7 @@ public function testUpdatingModelClearsCache()
])
->get(sha1(
"genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor_1_2_3_4_5_6_" .
- '7_8_9_10-genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbooks'
+ "7_8_9_10-genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbooks"
));
$this->assertNull($results);
@@ -84,7 +84,7 @@ public function testDeletingModelClearsCache()
])
->get(sha1(
"genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:authors:genealabslaravelmodelcachingtestsfixturesauthor_1_2_3_4_5_6_" .
- '7_8_9_10-genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbooks'
+ "7_8_9_10-genealabs:laravel-model-caching:testing:{$this->testingSqlitePath}testing.sqlite:genealabslaravelmodelcachingtestsfixturesbooks"
));
$this->assertNull($results);