Skip to content

Commit

Permalink
Merge branch 'main' into jbk/filter-negation
Browse files Browse the repository at this point in the history
  • Loading branch information
bakerkretzmar committed Sep 23, 2022
2 parents f20dcd0 + 9c5082e commit 583e703
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 13 deletions.
41 changes: 28 additions & 13 deletions .github/workflows/tests.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests
name: Test
on:
pull_request:
paths-ignore: ['dist/**', '*.md']
Expand All @@ -9,10 +9,11 @@ jobs:
test:
name: ${{ matrix.os[0] }}, PHP ${{ matrix.php }}, Laravel ${{ matrix.laravel }}
runs-on: ${{ matrix.os[1] }}
continue-on-error: ${{ matrix.php == '8.2' }}
strategy:
matrix:
os: [[Ubuntu, ubuntu-latest], [Windows, windows-latest]]
php: ['7.3', '7.4', '8.0', '8.1']
php: ['7.3', '7.4', '8.0', '8.1', '8.2']
laravel: [5.5.*, 5.6.*, 5.7.*, 5.8.*, 6.*, 7.*, 8.*, 9.*]
exclude:
- php: '7.3'
Expand All @@ -39,24 +40,38 @@ jobs:
laravel: 6.*
- php: '8.1'
laravel: 7.*
- php: '8.2'
laravel: 5.5.*
- php: '8.2'
laravel: 5.6.*
- php: '8.2'
laravel: 5.7.*
- php: '8.2'
laravel: 5.8.*
- php: '8.2'
laravel: 6.*
- php: '8.2'
laravel: 7.*
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: fileinfo
- uses: actions/cache@v2
- uses: actions/setup-node@v3
with:
path: ~/.composer/cache/files
key: php-${{ matrix.php }}-laravel-${{ matrix.laravel }}-composer-${{ hashFiles('composer.lock') }}
restore-keys: |
php-${{ matrix.php }}-laravel-${{ matrix.laravel }}-composer-
php-${{ matrix.php }}-laravel-
- uses: actions/cache@v1
node-version: 16
cache: 'npm'
- id: composer-cache-dir
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v3
with:
path: ~/.npm
key: npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: npm-
path: ${{ steps.composer-cache-dir.outputs.dir }}
key: ${{ runner.os }}-php-${{ matrix.php }}-laravel-${{ matrix.laravel }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php }}-laravel-${{ matrix.laravel }}-composer-
${{ runner.os }}-php-${{ matrix.php }}-laravel-
${{ runner.os }}-php-
- run: |
composer require laravel/framework:"${{ matrix.laravel }}" --no-update --no-interaction
composer update --prefer-dist --no-interaction
Expand Down
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@
]
}
},
"config": {
"allow-plugins": {
"kylekatarnls/update-helper": true
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
2 changes: 2 additions & 0 deletions src/js/Router.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ export default class Router extends String {
* @return {Object} Normalized complete route parameters.
*/
_parse(params = {}, route = this._route) {
params ??= {}

// If `params` is a string or integer, wrap it in an array
params = ['string', 'number'].includes(typeof params) ? [params] : params;

Expand Down
7 changes: 7 additions & 0 deletions tests/js/route.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,13 @@ describe('route()', () => {
same(route('optional', { id: 123, slug: null }), 'https://ziggy.dev/optional/123');
});

test('can ignore a single optional parameter', () => {
same(route('pages.optional'), 'https://ziggy.dev/optionalpage');
same(route('pages.optional', {}), 'https://ziggy.dev/optionalpage');
same(route('pages.optional', undefined), 'https://ziggy.dev/optionalpage');
same(route('pages.optional', null), 'https://ziggy.dev/optionalpage');
});

test('can error if a route name doesn’t exist', () => {
throws(() => route('unknown-route'), /Ziggy error: route 'unknown-route' is not in the route list\./);
});
Expand Down

0 comments on commit 583e703

Please sign in to comment.