chore: test laravel

This commit is contained in:
Feek 2020-06-21 16:48:33 -07:00
parent 35459bb545
commit df1c4f7b9c
4 changed files with 69 additions and 0 deletions

21
.github/workflows/test-laravel.yml vendored Normal file
View File

@ -0,0 +1,21 @@
name: Run Tests
on:
push:
pull_request:
schedule:
- cron: '0 0 * * *'
jobs:
build:
runs-on: ubuntu-latest
name: Test Laravel
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Test
run: |
./tests/laravel-test.sh

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="dev-master@02e8313c398b9c6cb6ded9210e5ef53ecd7a2dab">
<file src="app/Console/Kernel.php">
<UnresolvableInclude occurrences="1">
<code>require base_path('routes/console.php')</code>
</UnresolvableInclude>
</file>
<file src="app/Providers/BroadcastServiceProvider.php">
<UnresolvableInclude occurrences="1">
<code>require base_path('routes/channels.php')</code>
</UnresolvableInclude>
</file>
</files>

View File

@ -0,0 +1,18 @@
<psalm
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
errorLevel="1"
resolveFromConfigFile="false"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
errorBaseline="../psalm-plugin-laravel/tests/laravel-test-baseline.xml"
>
<projectFiles>
<directory name="app"/>
<ignoreFiles>
<directory name="vendor"/>
</ignoreFiles>
</projectFiles>
<plugins>
<pluginClass class="Psalm\LaravelPlugin\Plugin"/>
</plugins>
</psalm>

17
tests/laravel-test.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
set -e
echo "Cleaning Up"
rm -rf ../laravel/
echo "Installing Laravel"
composer create-project --quiet --prefer-dist "laravel/laravel" ../laravel
cd ../laravel/
echo "Adding package from source"
sed -e 's|"type": "project",|&"repositories": [ { "type": "path", "url": "../psalm-plugin-laravel" } ],|' -i '' composer.json
COMPOSER_MEMORY_LIMIT=-1 composer require --dev "psalm/plugin-laravel:*"
echo "Analyzing Laravel"
./vendor/bin/psalm -c ../psalm-plugin-laravel/tests/laravel-test-psalm.xml