diff --git a/.travis.yml b/.travis.yml index 7c0d000..263792f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,16 +5,12 @@ dist: trusty matrix: fast_finish: true include: - - php: 7.1 - env: LARAVEL=5.5.* ORCHESTRA=3.5.* - - php: 7.1 - env: LARAVEL=5.6.* ORCHESTRA=3.6.* - php: 7.2 - env: LARAVEL=5.7.* ORCHESTRA=3.7.* + env: LARAVEL=5.8.* ORCHESTRA=3.8.* - php: 7.2 - env: LARAVEL=5.8.* ORCHESTRA=3.8.* COVERAGE=1 + env: LARAVEL=6.0.* ORCHESTRA=4.0.* COVERAGE=1 - php: 7.3 - env: LARAVEL=5.8.* ORCHESTRA=3.8.* + env: LARAVEL=6.0.* ORCHESTRA=4.0.* allow_failures: - env: COVERAGE=1 diff --git a/composer.json b/composer.json index 941f7fe..cbc1443 100644 --- a/composer.json +++ b/composer.json @@ -21,21 +21,21 @@ "source": "https://github.com/richan-fongdasen/laravel-varnishable" }, "require": { - "php": "^7.1.3", + "php": "^7.2", "guzzlehttp/guzzle": "~6.0", - "illuminate/database": "5.5.*|5.6.*|5.7.*|5.8.*", - "illuminate/support": "5.5.*|5.6.*|5.7.*|5.8.*" + "illuminate/database": "5.8.*|6.0.*", + "illuminate/support": "5.8.*|6.0.*" }, "require-dev": { "mockery/mockery": "~1.0", - "orchestra/database": "~3.5", - "orchestra/testbench": "~3.5", + "orchestra/database": "~3.8|~4.0", + "orchestra/testbench": "~3.8|~4.0", "phpmd/phpmd": "^2.6", - "phpstan/phpstan": "^0.11.8", + "phpstan/phpstan": "^0.11.15", "phpstan/phpstan-deprecation-rules": "^0.11.2", "phpstan/phpstan-strict-rules": "^0.11.1", - "phpunit/phpunit": "^8.0 || ~7.0 || ~6.0", - "sebastian/phpcpd": "^4.1 || ~3.0" + "phpunit/phpunit": "^7.5|^8.0", + "sebastian/phpcpd": "^4.1" }, "config": { "sort-packages": true diff --git a/src/Concerns/ManageEtagHeader.php b/src/Concerns/ManageEtagHeader.php index 4a14a3c..ffc5258 100644 --- a/src/Concerns/ManageEtagHeader.php +++ b/src/Concerns/ManageEtagHeader.php @@ -15,8 +15,11 @@ trait ManageEtagHeader */ protected function addEtagHeader(Response $response) :void { - if ((bool) $this->getConfig('use_etag')) { - $response->setEtag(md5($response->getContent())); + $useEtag = (bool) $this->getConfig('use_etag'); + $content = $response->getContent(); + + if (($content !== false) && $useEtag) { + $response->setEtag(md5($content)); } } diff --git a/tests/Supports/database/factories/UserFactory.php b/tests/Supports/database/factories/UserFactory.php index a59d7e5..30ec5ab 100644 --- a/tests/Supports/database/factories/UserFactory.php +++ b/tests/Supports/database/factories/UserFactory.php @@ -1,5 +1,6 @@ define(User::class, function (\Faker\Generator $faker) { @@ -8,8 +9,8 @@ return [ 'name' => $faker->name, 'email' => $faker->email, - 'password' => bcrypt(str_random(12)), - 'remember_token' => str_random(12), + 'password' => bcrypt(Str::random(12)), + 'remember_token' => Str::random(12), 'created_at' => '2016-01-01 00:00:00', 'updated_at' => date('Y-m-d H:i:s', $time), ];