Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Refresh #34

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Bug Report
description: Report an Issue or Bug with the Package
title: "[Bug]: "
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
We're sorry to hear you have a problem. Can you help us solve it by providing the following details.
- type: textarea
id: what-happened
attributes:
label: What happened?
description: What did you expect to happen?
placeholder: I cannot currently do X thing because when I do, it breaks X thing.
validations:
required: true

- type: input
id: package-version
attributes:
label: Package Version
description: What version of our Package are you running? Please be as specific as possible
placeholder: 2.0.0
validations:
required: true
- type: input
id: php-version
attributes:
label: PHP Version
description: What version of PHP are you running? Please be as specific as possible
placeholder: 8.2.0
validations:
required: true
- type: input
id: laravel-version
attributes:
label: Laravel Version
description: What version of Laravel are you running? Please be as specific as possible
placeholder: 9.0.0
validations:
required: true
- type: dropdown
id: operating-systems
attributes:
label: Which operating systems does with happen with?
description: You may select more than one.
multiple: true
options:
- macOS
- Windows
- Linux
13 changes: 5 additions & 8 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Ask a question
url: https://github.com/codebar-ag/laravel-prerender/discussions/new?category=q-a
about: Ask the community for help
- name: Request a feature
url: https://github.com/codebar-ag/laravel-prerender/discussions/new?category=ideas
about: Share ideas for new features
- name: Report a bug
- name: Questions & Feature Requests
url: https://github.com/codebar-ag/laravel-prerender/issues/new
about: Report a reproducable bug
about: Ask the community for help
- name: Report a security issue
url: https://github.com/codebar-ag/laravel-prerender/security/policy
about: Learn how to notify us for sensitive bugs
73 changes: 36 additions & 37 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,59 @@
name: run-tests

on: [push, pull_request]
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
max-parallel: 1
matrix:
os: [ubuntu-latest]
php: [7.2, 7.3, 7.4, 8.0]
laravel: [6, 7, 8]
dependency-version: [prefer-lowest, prefer-stable]
os: [ ubuntu-latest, windows-latest ]
php: [ 8.2, 8.3 ]
laravel: [ 10.* ]
stability: [ prefer-lowest, prefer-stable ]
include:
- laravel: 8
testbench: 6.*
- laravel: 7
testbench: 5.*
- laravel: 6
testbench: 4.*
exclude:
- laravel: 6
php: 8.0
- laravel: 7
php: 8.0
- laravel: 8
php: 7.2
- laravel: 8
php: 7.3
- laravel: 8
php: 8.0
dependency-version: prefer-lowest

name: P${{ matrix.php }} - L${{ matrix.laravel }}.* - ${{ matrix.dependency-version }} - ${{ matrix.os }}
- laravel: 10.*
testbench: 8.*

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.composer/cache/files
key: dependencies-laravel-${{ matrix.laravel }}.*-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
coverage: pcov
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: none

- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}.*" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction

- name: Set phpunit.xml
run: cp phpunit.xml.dist phpunit.xml

- name: Execute tests
run: vendor/bin/phpunit
run: vendor/bin/pest

- name: Store test reports
uses: actions/upload-artifact@v2
with:
name: Store report
retention-days: 1
path: |
./reports
21 changes: 13 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,17 @@
}
],
"require": {
"php": ">=7.2",
"illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0",
"guzzlehttp/guzzle": "^6.0|^7.0",
"symfony/psr-http-message-bridge": "^1.3|^2.0"
"php": "^8.2",
"guzzlehttp/guzzle": "^7.8",
"illuminate/support": "^10.0",
"symfony/psr-http-message-bridge": "^2.3"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "3.0.0",
"orchestra/testbench": "^4.0|^5.0|^6.0",
"phpunit/phpunit": "^8.4|^9.0"
"friendsofphp/php-cs-fixer": "^3.46",
"orchestra/testbench": "^8.20",
"pestphp/pest": "^1.23",
"phpunit/phpunit": "^9.6",
"laravel/pint": "^1.13"
},
"autoload": {
"psr-4": {
Expand All @@ -54,7 +56,10 @@
"format": "vendor/bin/php-cs-fixer fix --allow-risky=yes --config=.php-cs-fixer.dist.php"
},
"config": {
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true
}
},
"extra": {
"laravel": {
Expand Down
4 changes: 2 additions & 2 deletions config/prerender.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
'*.ttf',
'*.otf',
'*.woff',
'*.woff2'
'*.woff2',
],

/*
Expand Down Expand Up @@ -178,7 +178,7 @@
'nuzzel',
'Discordbot',
'Google Page Speed',
'Qwantify'
'Qwantify',
],

];
4 changes: 2 additions & 2 deletions src/LaravelPrerenderServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class LaravelPrerenderServiceProvider extends ServiceProvider
public function boot(): void
{
$this->publishes([
__DIR__ . '/../config/prerender.php' => config_path('prerender.php'),
__DIR__.'/../config/prerender.php' => config_path('prerender.php'),
], 'config');

if (config('prerender.enable')) {
Expand All @@ -30,7 +30,7 @@ public function boot(): void
public function register(): void
{
$this->mergeConfigFrom(
__DIR__ . '/../config/prerender.php',
__DIR__.'/../config/prerender.php',
'prerender'
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/PrerenderMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ private function getPrerenderedPageResponse(Request $request): ?ResponseInterfac
$path = '';
}

return $this->client->get($this->prerenderUri . '/' . urlencode($protocol.'://'.$host.'/'.$path), compact('headers'));
return $this->client->get($this->prerenderUri.'/'.urlencode($protocol.'://'.$host.'/'.$path), compact('headers'));
} catch (RequestException $exception) {
if (!$this->returnSoftHttpCodes && !empty($exception->getResponse()) && $exception->getResponse()->getStatusCode() === 404) {
abort(404);
Expand Down
1 change: 1 addition & 0 deletions tests/Pest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php
2 changes: 1 addition & 1 deletion tests/PrerenderMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function it_should_prerender_page_with_escaped_fragment_in_query_string()
/** @test */
public function it_should_prerender_when_user_agent_is_part_of_crawler_user_agents()
{
$this->get('/test-middleware', ['User-Agent' => 'Googlebot/2.1 (+http://www.google.com/bot.html)',])
$this->get('/test-middleware', ['User-Agent' => 'Googlebot/2.1 (+http://www.google.com/bot.html)'])
->assertHeader('prerender.io-mock', true)
->assertSuccessful();
}
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ protected function setUp(): void
}

/**
* @param Application $app
* @param Application $app
*/
protected function getPackageProviders($app): array
{
Expand All @@ -32,7 +32,7 @@ protected function getPackageProviders($app): array
}

/**
* @param Application $app
* @param Application $app
*/
protected function getEnvironmentSetUp($app): void
{
Expand Down
Loading