diff --git a/.gitignore b/.gitignore index 2b121e0..5b5dbf4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /build /vendor composer.lock +.phpunit.result.cache diff --git a/.travis.yml b/.travis.yml index 0876996..2beeab0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,6 @@ env: matrix: include: - - php: 7.1.3 - php: 7.2 - php: 7.3 diff --git a/composer.json b/composer.json index 2f3e0e9..fa5e2e1 100644 --- a/composer.json +++ b/composer.json @@ -10,24 +10,22 @@ ], "require": { "genealabs/laravel-pivot-events": "*", - "illuminate/cache": "5.8.*", - "illuminate/config": "5.8.*", - "illuminate/console": "5.8.*", - "illuminate/container": "5.8.*", - "illuminate/database": "5.8.*", - "illuminate/support": "5.8.*", - "illuminate/http": "5.8.*", - "php": "^7.1.3" + "illuminate/cache": "5.8 - 6.0", + "illuminate/config": "5.8 - 6.0", + "illuminate/console": "5.8 - 6.0", + "illuminate/container": "5.8 - 6.0", + "illuminate/database": "5.8 - 6.0", + "illuminate/support": "5.8 - 6.0", + "illuminate/http": "5.8 - 6.0" }, "require-dev": { "fzaninotto/faker": "*", "mockery/mockery": "*", - "orchestra/database": "3.8.*", - "orchestra/testbench-browser-kit": "3.8.*", - "orchestra/testbench": "3.8.*", + "orchestra/testbench-browser-kit": "3.9.x-dev@dev", + "orchestra/testbench": "3.9.x-dev@dev", "php-coveralls/php-coveralls" : "*", "phpmd/phpmd": "*", - "phpunit/phpunit": "^7.5", + "phpunit/phpunit": "*", "predis/predis": "*", "sebastian/phpcpd": "*", "symfony/thanks": "*" @@ -52,5 +50,7 @@ "GeneaLabs\\LaravelModelCaching\\Providers\\Service" ] } - } + }, + "minimum-stability": "dev", + "prefer-stable": true } diff --git a/phpunit.xml b/phpunit.xml index cff344c..5ca1e2c 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -34,9 +34,6 @@ - - - - + diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.php index d6a731d..4d13dcf 100644 --- a/tests/CreatesApplication.php +++ b/tests/CreatesApplication.php @@ -1,7 +1,6 @@ set('database.redis.cache', [ 'host' => env('REDIS_HOST', '127.0.0.1'), + 'port' => env('REDIS_PORT', 6379), ]); $app['config']->set('database.redis.default', [ 'host' => env('REDIS_HOST', '127.0.0.1'), + 'port' => env('REDIS_PORT', 6379), ]); $app['config']->set('database.redis.model-cache', [ 'host' => env('REDIS_HOST', '127.0.0.1'), diff --git a/tests/Feature/PaginationTest.php b/tests/Feature/PaginationTest.php index a118293..d5ed5bb 100644 --- a/tests/Feature/PaginationTest.php +++ b/tests/Feature/PaginationTest.php @@ -2,25 +2,27 @@ use GeneaLabs\LaravelModelCaching\Tests\FeatureTestCase; use GeneaLabs\LaravelModelCaching\Tests\Fixtures\Book; +use Illuminate\Support\Str; class PaginationTest extends FeatureTestCase { public function testPaginationProvidesDifferentLinksOnDifferentPages() { - if (starts_with(app()->version(), "5.6") - || starts_with(app()->version(), "5.7") - || starts_with(app()->version(), "5.8") + 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") ) { $page1ActiveLink = '
  • 1
  • '; $page2ActiveLink = '
  • 2
  • '; } - if (starts_with(app()->version(), "5.5")) { + if (Str::startsWith(app()->version(), "5.5")) { $page1ActiveLink = '
  • 1
  • '; $page2ActiveLink = '
  • 2
  • '; } - if (starts_with(app()->version(), "5.4")) { + if (Str::startsWith(app()->version(), "5.4")) { $page1ActiveLink = '
  • 1
  • '; $page2ActiveLink = '
  • 2
  • '; } @@ -39,20 +41,21 @@ public function testPaginationProvidesDifferentLinksOnDifferentPages() public function testAdvancedPagination() { - if (starts_with(app()->version(), "5.6") - || starts_with(app()->version(), "5.7") - || starts_with(app()->version(), "5.8") + 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") ) { $page1ActiveLink = '
  • 1
  • '; $page2ActiveLink = '
  • 2
  • '; } - if (starts_with(app()->version(), "5.5")) { + if (Str::startsWith(app()->version(), "5.5")) { $page1ActiveLink = '
  • 1
  • '; $page2ActiveLink = '
  • 2
  • '; } - if (starts_with(app()->version(), "5.4")) { + if (Str::startsWith(app()->version(), "5.4")) { $page1ActiveLink = '
  • 1
  • '; $page2ActiveLink = '
  • 2
  • '; } @@ -64,20 +67,21 @@ public function testAdvancedPagination() public function testCustomPagination() { - if (starts_with(app()->version(), "5.6") - || starts_with(app()->version(), "5.7") - || starts_with(app()->version(), "5.8") + 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") ) { $page1ActiveLink = '
  • 1
  • '; $page2ActiveLink = '
  • 2
  • '; } - if (starts_with(app()->version(), "5.5")) { + if (Str::startsWith(app()->version(), "5.5")) { $page1ActiveLink = '
  • 1
  • '; $page2ActiveLink = '
  • 2
  • '; } - if (starts_with(app()->version(), "5.4")) { + if (Str::startsWith(app()->version(), "5.4")) { $page1ActiveLink = '
  • 1
  • '; $page2ActiveLink = '
  • 2
  • '; } diff --git a/tests/Integration/CachedBuilder/PaginateTest.php b/tests/Integration/CachedBuilder/PaginateTest.php index 58d0b47..7df45a4 100644 --- a/tests/Integration/CachedBuilder/PaginateTest.php +++ b/tests/Integration/CachedBuilder/PaginateTest.php @@ -1,9 +1,10 @@ -version(), "5.6") - || starts_with(app()->version(), "5.7") - || starts_with(app()->version(), "5.8") + 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") ) { $page1ActiveLink = '
  • 1
  • '; $page2ActiveLink = '
  • 2
  • '; $page24ActiveLink = '
  • 24
  • '; } - if (starts_with(app()->version(), "5.5")) { + if (Str::startsWith(app()->version(), "5.5")) { $page1ActiveLink = '
  • 1
  • '; $page2ActiveLink = '
  • 2
  • '; $page24ActiveLink = '
  • 24
  • '; } - if (starts_with(app()->version(), "5.4")) { + if (Str::startsWith(app()->version(), "5.4")) { $page1ActiveLink = '
  • 1
  • '; $page2ActiveLink = '
  • 2
  • '; $page24ActiveLink = '
  • 24
  • '; @@ -66,29 +68,30 @@ public function testPaginationReturnsCorrectLinks() $this->assertCount(2, $booksPage1); $this->assertCount(2, $booksPage2); $this->assertCount(2, $booksPage24); - $this->assertContains($page1ActiveLink, (string) $booksPage1->links()); - $this->assertContains($page2ActiveLink, (string) $booksPage2->links()); - $this->assertContains($page24ActiveLink, (string) $booksPage24->links()); + $this->assertStringContainsString($page1ActiveLink, (string) $booksPage1->links()); + $this->assertStringContainsString($page2ActiveLink, (string) $booksPage2->links()); + $this->assertStringContainsString($page24ActiveLink, (string) $booksPage24->links()); } public function testPaginationWithOptionsReturnsCorrectLinks() { - if (starts_with(app()->version(), "5.6") - || starts_with(app()->version(), "5.7") - || starts_with(app()->version(), "5.8") + 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") ) { $page1ActiveLink = '
  • 1
  • '; $page2ActiveLink = '
  • 2
  • '; $page24ActiveLink = '
  • 24
  • '; } - if (starts_with(app()->version(), "5.5")) { + if (Str::startsWith(app()->version(), "5.5")) { $page1ActiveLink = '
  • 1
  • '; $page2ActiveLink = '
  • 2
  • '; $page24ActiveLink = '
  • 24
  • '; } - if (starts_with(app()->version(), "5.4")) { + if (Str::startsWith(app()->version(), "5.4")) { $page1ActiveLink = '
  • 1
  • '; $page2ActiveLink = '
  • 2
  • '; $page24ActiveLink = '
  • 24
  • '; @@ -104,29 +107,30 @@ public function testPaginationWithOptionsReturnsCorrectLinks() $this->assertCount(2, $booksPage1); $this->assertCount(2, $booksPage2); $this->assertCount(2, $booksPage24); - $this->assertContains($page1ActiveLink, (string) $booksPage1->links()); - $this->assertContains($page2ActiveLink, (string) $booksPage2->links()); - $this->assertContains($page24ActiveLink, (string) $booksPage24->links()); + $this->assertStringContainsString($page1ActiveLink, (string) $booksPage1->links()); + $this->assertStringContainsString($page2ActiveLink, (string) $booksPage2->links()); + $this->assertStringContainsString($page24ActiveLink, (string) $booksPage24->links()); } public function testPaginationWithCustomOptionsReturnsCorrectLinks() { - if (starts_with(app()->version(), "5.6") - || starts_with(app()->version(), "5.7") - || starts_with(app()->version(), "5.8") + 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") ) { $page1ActiveLink = '
  • 1
  • '; $page2ActiveLink = '
  • 2
  • '; $page24ActiveLink = '
  • 24
  • '; } - if (starts_with(app()->version(), "5.5")) { + if (Str::startsWith(app()->version(), "5.5")) { $page1ActiveLink = '
  • 1
  • '; $page2ActiveLink = '
  • 2
  • '; $page24ActiveLink = '
  • 24
  • '; } - if (starts_with(app()->version(), "5.4")) { + if (Str::startsWith(app()->version(), "5.4")) { $page1ActiveLink = '
  • 1
  • '; $page2ActiveLink = '
  • 2
  • '; $page24ActiveLink = '
  • 24
  • '; @@ -142,9 +146,9 @@ public function testPaginationWithCustomOptionsReturnsCorrectLinks() $this->assertCount(2, $booksPage1); $this->assertCount(2, $booksPage2); $this->assertCount(2, $booksPage24); - $this->assertContains($page1ActiveLink, (string) $booksPage1->links()); - $this->assertContains($page2ActiveLink, (string) $booksPage2->links()); - $this->assertContains($page24ActiveLink, (string) $booksPage24->links()); + $this->assertStringContainsString($page1ActiveLink, (string) $booksPage1->links()); + $this->assertStringContainsString($page2ActiveLink, (string) $booksPage2->links()); + $this->assertStringContainsString($page24ActiveLink, (string) $booksPage24->links()); } public function testCustomPageNamePagination() diff --git a/tests/Integration/CachedBuilder/WhereJsonContainsTest.php b/tests/Integration/CachedBuilder/WhereJsonContainsTest.php index 688b2b1..d164bfe 100644 --- a/tests/Integration/CachedBuilder/WhereJsonContainsTest.php +++ b/tests/Integration/CachedBuilder/WhereJsonContainsTest.php @@ -14,6 +14,8 @@ protected function getEnvironmentSetUp($app) parent::getEnvironmentSetUp($app); $app['config']->set('database.default', 'pgsql'); + $app['config']->set('database.connections.pgsql.database', "testing"); + $app['config']->set('database.connections.pgsql.username', "mike"); } public function setUp() : void diff --git a/tests/Integration/CachedBuilderTest.php b/tests/Integration/CachedBuilderTest.php index 87ad854..4e9f7ca 100644 --- a/tests/Integration/CachedBuilderTest.php +++ b/tests/Integration/CachedBuilderTest.php @@ -5,6 +5,7 @@ use GeneaLabs\LaravelModelCaching\Tests\Fixtures\UncachedAuthor; use GeneaLabs\LaravelModelCaching\Tests\Fixtures\Http\Resources\Author as AuthorResource; use GeneaLabs\LaravelModelCaching\Tests\IntegrationTestCase; +use Illuminate\Support\Str; /** * @SuppressWarnings(PHPMD.TooManyPublicMethods) @@ -415,7 +416,7 @@ public function testLazyLoadedRelationshipResolvesThroughCachedBuilder() public function testLazyLoadingOnResourceIsCached() { - if (starts_with(app()->version(), "5.4")) { + if (Str::startsWith(app()->version(), "5.4")) { $this->markTestIncomplete("Resources don't exist in Laravel 5.4."); } diff --git a/tests/Integration/Console/Commands/FlushTest.php b/tests/Integration/Console/Commands/FlushTest.php index f009cd9..5cfa5e9 100644 --- a/tests/Integration/Console/Commands/FlushTest.php +++ b/tests/Integration/Console/Commands/FlushTest.php @@ -6,6 +6,7 @@ use GeneaLabs\LaravelModelCaching\Tests\Fixtures\UncachedAuthor; use GeneaLabs\LaravelModelCaching\Tests\Fixtures\PrefixedAuthor; use GeneaLabs\LaravelModelCaching\Tests\IntegrationTestCase; +use Illuminate\Support\Str; class FlushTest extends IntegrationTestCase { @@ -13,7 +14,7 @@ public function setUp() : void { parent::setUp(); - if (starts_with($this->app->version(), '5.7')) { + if (Str::startsWith($this->app->version(), '5.7')) { $this->withoutMockingConsoleOutput(); } } diff --git a/tests/database/baseline.sqlite b/tests/database/baseline.sqlite index 2bfe075..2cb5cf6 100644 Binary files a/tests/database/baseline.sqlite and b/tests/database/baseline.sqlite differ diff --git a/tests/database/testing.sqlite b/tests/database/testing.sqlite index 2bfe075..2cb5cf6 100644 Binary files a/tests/database/testing.sqlite and b/tests/database/testing.sqlite differ