tweak about testing

This commit is contained in:
Pig Fang 2020-03-09 15:08:45 +08:00
parent 4d3f6a29ca
commit db49cedb06
4 changed files with 6 additions and 49 deletions

View File

@ -1,19 +1,19 @@
APP_DEBUG=false
APP_ENV=testing
DB_CONNECTION=mysql
DB_CONNECTION=sqlite
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=test
DB_DATABASE=:memory:
DB_USERNAME=root
DB_PASSWORD=root
DB_PREFIX=
PWD_METHOD=BCRYPT
SALT=c67709dd8b7b733aca0d570681fe96cf
BCRYPT_ROUNDS=4
APP_KEY=base64:eVX/xzF5NhpGB2luswliFx9XSBsbbAP21wOi68X/P34=
MAIL_MAILER=smtp
MAIL_MAILER=array
MAIL_HOST=localhost
MAIL_PORT=465
MAIL_USERNAME=

View File

@ -57,17 +57,13 @@ jobs:
restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies
run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader
- name: Prepare application
run: |
cp .env.example .env
php artisan key:generate
- name: Run tests only
if: matrix.php != '7.2'
run: ./scripts/phpunit.ps1
run: ./vendor/bin/phpunit
shell: pwsh
- name: Run tests with coverage report
if: matrix.php == '7.2'
run: ./scripts/phpunit.ps1 -Coverage
run: ./vendor/bin/phpunit --coverage-clover=coverage.xml
shell: pwsh
- name: Upload coverage report
uses: codecov/codecov-action@v1

View File

@ -1,8 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit colors="true"
backupGlobals="false"
stopOnFailure="false"
processIsolation="false"
backupStaticAttributes="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"

View File

@ -1,36 +0,0 @@
param (
[Parameter(Position = 0)]
[string]
$Filter,
[Parameter()]
[switch]
$Bail,
# For CI only
[Parameter()]
[switch]
$Coverage
)
$dbPath = [System.IO.Path]::GetTempPath() + 'bs.db'
$env:DB_CONNECTION = 'sqlite'
$env:DB_DATABASE = $dbPath
if (Test-Path $dbPath) {
Remove-Item $dbPath
}
New-Item $dbPath | Out-Null
$arguments = ''
if ($Filter) {
$arguments += " --filter=$Filter"
}
if ($Bail) {
$arguments += ' --stop-on-failure'
}
if ($Coverage) {
$arguments += ' --coverage-clover=coverage.xml'
}
./vendor/bin/phpunit $arguments