diff --git a/.github/workflows/unit-testing.yml b/.github/workflows/unit-testing.yml new file mode 100644 index 00000000..df0c48cd --- /dev/null +++ b/.github/workflows/unit-testing.yml @@ -0,0 +1,41 @@ +name: Unit Testing + +on: + push: + branches: [ master, oasis ] + pull_request: + branches: [ master, oasis ] + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + os: [ubuntu-latest] + php: [8.0] + stability: [prefer-stable] + + name: P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }} + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: ctype, json, exif, 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 update --${{ matrix.stability }} --prefer-dist --no-interaction + + - name: Run tests + run: vendor/bin/phpunit diff --git a/README.md b/README.md index bf6fa1d7..246054eb 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ [![Frontend Build](https://github.com/MakingCG/vuefilemanager/actions/workflows/build.yml/badge.svg)](https://github.com/MakingCG/vuefilemanager/actions/workflows/build.yml) +[![Unit Testing](https://github.com/MakingCG/vuefilemanager/actions/workflows/unit-testing.yml/badge.svg)](https://github.com/MakingCG/vuefilemanager/actions/workflows/unit-testing.yml) ![logo](https://vuefilemanager.com/assets/images/vuefilemanager-horizontal-logo.svg) # Private Cloud Storage Build on Laravel & Vue.js diff --git a/composer.json b/composer.json index 5e71c95f..e7d7a36f 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,8 @@ ], "license": "MIT", "require": { - "php": "^7.3", + "php": "^8.0", + "ext-json": "*", "barryvdh/laravel-snappy": "^0.4.8", "brianium/paratest": "^6.2", "cartalyst/stripe-laravel": "^13.1", @@ -16,7 +17,6 @@ "fideloper/proxy": "^4.4.1", "friendsofphp/php-cs-fixer": "^2.18", "fruitcake/laravel-cors": "^2.0.3", - "fzaninotto/faker": "^1.9", "gabrielelana/byte-units": "^0.5.0", "guzzlehttp/guzzle": "^7.2.0", "h4cc/wkhtmltopdf-amd64": "0.12.x", @@ -33,16 +33,17 @@ "league/flysystem-cached-adapter": "^1.1.0", "madnest/madzipper": "^1.1.0", "spatie/laravel-backup": "^6.15", - "teamtnt/laravel-scout-tntsearch-driver": "^11.1.0" + "teamtnt/laravel-scout-tntsearch-driver": "^11.1.0", + "vimeo/psalm": "^4.7" }, "require-dev": { "ext-json": "*", "barryvdh/laravel-ide-helper": "^2.9", "facade/ignition": "^2.5.14", + "fakerphp/faker": "^1.14.1", "mockery/mockery": "^1.4.3", "nunomaduro/collision": "^5.3.0", - "phpunit/phpunit": "^9.5.2", - "supliu/laravel-query-monitor": "^1.0.2" + "phpunit/phpunit": "^9.5.2" }, "config": { "optimize-autoloader": true, @@ -87,6 +88,7 @@ "post-create-project-cmd": [ "@php artisan key:generate --ansi" ], - "format": "vendor/bin/php-cs-fixer fix --allow-risky=yes" + "format": "vendor/bin/php-cs-fixer fix --allow-risky=yes", + "psalm": "vendor/bin/psalm" } } diff --git a/psalm.xml.dist b/psalm.xml.dist new file mode 100644 index 00000000..f327d329 --- /dev/null +++ b/psalm.xml.dist @@ -0,0 +1,16 @@ + + + + + + + + + diff --git a/tests/Unit/ExampleTest.php b/tests/Unit/ExampleTest.php new file mode 100644 index 00000000..25e8535d --- /dev/null +++ b/tests/Unit/ExampleTest.php @@ -0,0 +1,18 @@ +assertTrue(true); + } +} \ No newline at end of file