Skip to content

Commit 097fe5b

Browse files
authored
Merge pull request #220 from inertiajs/inertia-laravel-testing
Merge inertia-laravel-testing into inertia-laravel
2 parents 726b1e0 + d1c3d34 commit 097fe5b

24 files changed

+2032
-28
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
; This file is for unifying the coding style for different editors and IDEs.
2+
; More information at https://editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
indent_size = 4
9+
indent_style = space
10+
end_of_line = lf
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
13+
14+
[*.md]
15+
trim_trailing_whitespace = false

.gitattributes

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Path-based git attributes
2+
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
3+
4+
# Ignore all test and documentation with "export-ignore".
5+
/.editorconfig export-ignore
6+
/.gitattributes export-ignore
7+
/.gitignore export-ignore
8+
/.github export-ignore
9+
/.php_cs.dist export-ignore
10+
/.styleci.yml export-ignore
11+
/.scrutinizer.yml export-ignore
12+
/.travis.yml export-ignore
13+
/phpunit.xml.dist export-ignore
14+
/tests export-ignore
15+
/CHANGELOG.md export-ignore
16+
/CONTRIBUTING.md export-ignore
17+
/README.md export-ignore

.github/workflows/tests.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: tests
2+
3+
on:
4+
push:
5+
pull_request:
6+
schedule:
7+
- cron: '0 0 * * *'
8+
9+
jobs:
10+
tests:
11+
runs-on: ubuntu-20.04
12+
strategy:
13+
fail-fast: true
14+
matrix:
15+
php:
16+
- 7.2
17+
- 7.3
18+
- 7.4
19+
- 8.0
20+
composerFlags:
21+
- '--prefer-lowest'
22+
- ''
23+
24+
name: PHP ${{ matrix.php }} w/ Composer ${{ matrix.composerFlags }}
25+
steps:
26+
- name: Checkout code
27+
uses: actions/checkout@v2
28+
29+
- name: Setup PHP
30+
uses: shivammathur/setup-php@v2
31+
with:
32+
php-version: ${{ matrix.php }}
33+
extensions: dom, curl, libxml, mbstring, zip
34+
tools: composer:v2
35+
coverage: none
36+
37+
- name: Install dependencies
38+
run: |
39+
composer update --prefer-dist --no-interaction --no-progress ${{ matrix.composerFlags }}
40+
41+
- name: Execute tests
42+
run: vendor/bin/phpunit --verbose

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
/vendor
2-
.DS_Store
1+
.env
32
.phpunit.result.cache
43
composer.lock
4+
phpunit.xml
5+
/vendor

_ide_helpers.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
/** @noinspection PhpUndefinedClassInspection */
4+
/** @noinspection PhpFullyQualifiedNameUsageInspection */
5+
/** @noinspection PhpUnusedAliasInspection */
6+
7+
namespace Illuminate\Testing {
8+
9+
/**
10+
* @see \Inertia\Testing\TestResponseMacros
11+
*
12+
* @method self assertInertia(\Closure $assert = null)
13+
*/
14+
class TestResponse
15+
{
16+
//
17+
}
18+
}
19+
20+
namespace Illuminate\Foundation\Testing {
21+
22+
/**
23+
* @see \Inertia\Testing\TestResponseMacros
24+
*
25+
* @method self assertInertia(\Closure $assert = null)
26+
*/
27+
class TestResponse
28+
{
29+
//
30+
}
31+
}

composer.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,14 @@
2525
}
2626
},
2727
"require": {
28+
"php": "^7.2|^8.0",
29+
"ext-json": "*",
2830
"laravel/framework": "^5.4|^6.0|^7.0|^8.0"
2931
},
3032
"require-dev": {
31-
"orchestra/testbench": "~3.0"
33+
"roave/security-advisories": "dev-master",
34+
"orchestra/testbench": "^4.0|^5.0|^6.0",
35+
"phpunit/phpunit": "^8.0|^9.0"
3236
},
3337
"extra": {
3438
"laravel": {

config/inertia.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
return [
4+
5+
/*
6+
|--------------------------------------------------------------------------
7+
| Testing
8+
|--------------------------------------------------------------------------
9+
|
10+
| The values described here are used to locate Inertia components on the
11+
| filesystem. For instance, when using `assertInertia`, the assertion
12+
| attempts to locate the component as a file relative to any of the
13+
| paths AND with any of the extensions specified here.
14+
|
15+
*/
16+
17+
'testing' => [
18+
19+
'ensure_pages_exist' => true,
20+
21+
'page_paths' => [
22+
23+
resource_path('js/Pages'),
24+
25+
],
26+
27+
'page_extensions' => [
28+
29+
'js',
30+
'svelte',
31+
'ts',
32+
'vue',
33+
34+
],
35+
36+
],
37+
38+
];

phpunit.xml

Lines changed: 0 additions & 20 deletions
This file was deleted.

phpunit.xml.dist

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit bootstrap="vendor/autoload.php"
3+
backupGlobals="false"
4+
backupStaticAttributes="false"
5+
colors="true"
6+
verbose="true"
7+
convertErrorsToExceptions="true"
8+
convertNoticesToExceptions="true"
9+
convertWarningsToExceptions="true"
10+
processIsolation="false"
11+
stopOnFailure="false">
12+
<testsuites>
13+
<testsuite name="Test Suite">
14+
<directory>tests</directory>
15+
</testsuite>
16+
</testsuites>
17+
<filter>
18+
<whitelist>
19+
<directory suffix=".php">src/</directory>
20+
</whitelist>
21+
</filter>
22+
</phpunit>
23+

readme.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
11
# Inertia.js Laravel Adapter
22

3+
<p align="left">
4+
<a href="https://github.com/inertiajs/inertia-laravel/releases">
5+
<img src="https://img.shields.io/github/release/inertiajs/inertia-laravel.svg?style=flat-square" alt="Latest Version">
6+
</a>
7+
<a href="https://github.com/inertiajs/inertia-laravel/actions?query=workflow%3Atests+branch%3Amaster">
8+
<img src="https://img.shields.io/github/workflow/status/inertiajs/inertia-laravel/tests/master.svg?style=flat-square" alt="Build Status">
9+
</a>
10+
<a href="https://styleci.io/repos/174395905"><img src="https://styleci.io/repos/174395905/shield" alt="StyleCI"></a>
11+
<a href="https://packagist.org/packages/inertiajs/inertia-laravel">
12+
<img src="https://img.shields.io/packagist/dt/inertiajs/inertia-laravel.svg?style=flat-square" alt="Total Downloads">
13+
</a>
14+
</p>
15+
16+
---
17+
318
Visit [inertiajs.com](https://inertiajs.com/) to learn more.

0 commit comments

Comments
 (0)