mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2025-01-09 04:27:47 +08:00
Get ready for PHPUnit
This commit is contained in:
parent
74d6b55483
commit
71438446fe
53
.travis.yml
53
.travis.yml
@ -1,7 +1,54 @@
|
||||
language: node_js
|
||||
node_js: 8
|
||||
language: php
|
||||
|
||||
git:
|
||||
submodules: false
|
||||
|
||||
cache: yarn
|
||||
cache:
|
||||
directories:
|
||||
- vendor
|
||||
- node_modules
|
||||
|
||||
env:
|
||||
global: APP_ENV=testing DB_HOST=localhost DB_USERNAME=root DB_PASSWORD= DB_DATABASE=blessing_test
|
||||
|
||||
before_install:
|
||||
- if [[ $TEST_TYPE == 'php' ]]; then mysql -e 'CREATE DATABASE blessing_test;' ; fi
|
||||
|
||||
install:
|
||||
- composer install
|
||||
|
||||
before_script:
|
||||
- if [[ $TEST_TYPE == 'php' ]]; then php artisan key:generate ; fi
|
||||
|
||||
script:
|
||||
- ./vendor/bin/phpunit
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- php: 5.6
|
||||
env: TEST_TYPE=php
|
||||
services:
|
||||
- mysql
|
||||
- php: 7.0
|
||||
env: TEST_TYPE=php
|
||||
services:
|
||||
- mysql
|
||||
script:
|
||||
- ./vendor/bin/phpunit --coverage-clover=coverage.xml
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash) -cF php
|
||||
- php: 7.1
|
||||
env: TEST_TYPE=php
|
||||
services:
|
||||
- mysql
|
||||
- node_js: 8
|
||||
language: node_js
|
||||
node_js: 8
|
||||
env: TEST_TYPE=js
|
||||
install:
|
||||
- yarn
|
||||
script:
|
||||
- yarn run lint
|
||||
- yarn test:coverage
|
||||
after_success:
|
||||
- yarn run codecov
|
||||
|
@ -35,10 +35,13 @@
|
||||
},
|
||||
"autoload-dev": {
|
||||
"classmap": [
|
||||
"tests",
|
||||
"database"
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
"post-install-cmd": [
|
||||
"php -r \"file_exists('.env') || copy('.env.example', '.env');\"",
|
||||
"Illuminate\\Foundation\\ComposerScripts::postInstall",
|
||||
"php artisan optimize"
|
||||
],
|
||||
|
2
composer.lock
generated
2
composer.lock
generated
@ -3700,7 +3700,7 @@
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
"php": "^5.5.9"
|
||||
"php": ">=5.5.9"
|
||||
},
|
||||
"platform-dev": []
|
||||
}
|
||||
|
@ -15,11 +15,13 @@
|
||||
"release": "gulp zip",
|
||||
"test": "jest --silent",
|
||||
"test:watch": "jest --silent --watch",
|
||||
"test:cover": "jest --silent --coverage",
|
||||
"test:coverage": "jest --silent --coverage --coverageDirectory ./coverage/",
|
||||
"codecov": "codecov -F js",
|
||||
"dev": "gulp watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-preset-es2015": "^6.24.1",
|
||||
"codecov": "^3.0.0",
|
||||
"del": "^3.0.0",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-babel": "^6.1.2",
|
||||
|
30
phpunit.xml
Normal file
30
phpunit.xml
Normal file
@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit backupGlobals="false"
|
||||
backupStaticAttributes="false"
|
||||
bootstrap="bootstrap/autoload.php"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false">
|
||||
<testsuites>
|
||||
<testsuite name="Application Test Suite">
|
||||
<directory suffix="Test.php">./tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<filter>
|
||||
<whitelist processUncoveredFilesFromWhitelist="true">
|
||||
<directory suffix=".php">./app</directory>
|
||||
<exclude>
|
||||
<file>./app/Http/routes.php</file>
|
||||
</exclude>
|
||||
</whitelist>
|
||||
</filter>
|
||||
<php>
|
||||
<env name="APP_ENV" value="testing"/>
|
||||
<env name="CACHE_DRIVER" value="array"/>
|
||||
<env name="SESSION_DRIVER" value="array"/>
|
||||
<env name="QUEUE_DRIVER" value="sync"/>
|
||||
</php>
|
||||
</phpunit>
|
25
tests/TestCase.php
Normal file
25
tests/TestCase.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
class TestCase extends Illuminate\Foundation\Testing\TestCase
|
||||
{
|
||||
/**
|
||||
* The base URL to use while testing the application.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $baseUrl = 'http://localhost';
|
||||
|
||||
/**
|
||||
* Creates the application.
|
||||
*
|
||||
* @return \Illuminate\Foundation\Application
|
||||
*/
|
||||
public function createApplication()
|
||||
{
|
||||
$app = require __DIR__.'/../bootstrap/app.php';
|
||||
|
||||
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
|
||||
|
||||
return $app;
|
||||
}
|
||||
}
|
18
tests/UtilsTest.php
Normal file
18
tests/UtilsTest.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
|
||||
class UtilsTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* A basic test example.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testExample()
|
||||
{
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
}
|
18
yarn.lock
18
yarn.lock
@ -134,6 +134,10 @@ argparse@^1.0.7:
|
||||
dependencies:
|
||||
sprintf-js "~1.0.2"
|
||||
|
||||
argv@0.0.2:
|
||||
version "0.0.2"
|
||||
resolved "https://registry.yarnpkg.com/argv/-/argv-0.0.2.tgz#ecbd16f8949b157183711b1bda334f37840185ab"
|
||||
|
||||
arr-diff@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "http://registry.npm.taobao.org/arr-diff/download/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf"
|
||||
@ -861,6 +865,14 @@ code-point-at@^1.0.0:
|
||||
version "1.1.0"
|
||||
resolved "http://registry.npm.taobao.org/code-point-at/download/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77"
|
||||
|
||||
codecov@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/codecov/-/codecov-3.0.0.tgz#c273b8c4f12945723e8dc9d25803d89343e5f28e"
|
||||
dependencies:
|
||||
argv "0.0.2"
|
||||
request "2.81.0"
|
||||
urlgrey "0.4.4"
|
||||
|
||||
color-convert@^1.9.0:
|
||||
version "1.9.0"
|
||||
resolved "http://registry.npm.taobao.org/color-convert/download/color-convert-1.9.0.tgz#1accf97dd739b983bf994d56fec8f95853641b7a"
|
||||
@ -3318,7 +3330,7 @@ replace-ext@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "http://registry.npm.taobao.org/replace-ext/download/replace-ext-1.0.0.tgz#de63128373fcbf7c3ccfa4de5a480c45a67958eb"
|
||||
|
||||
request@2, request@^2.79.0:
|
||||
request@2, request@2.81.0, request@^2.79.0:
|
||||
version "2.81.0"
|
||||
resolved "http://registry.npm.taobao.org/request/download/request-2.81.0.tgz#c6928946a0e06c5f8d6f8a9333469ffda46298a0"
|
||||
dependencies:
|
||||
@ -3846,6 +3858,10 @@ unique-stream@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "http://registry.npm.taobao.org/unique-stream/download/unique-stream-1.0.0.tgz#d59a4a75427447d9aa6c91e70263f8d26a4b104b"
|
||||
|
||||
urlgrey@0.4.4:
|
||||
version "0.4.4"
|
||||
resolved "https://registry.yarnpkg.com/urlgrey/-/urlgrey-0.4.4.tgz#892fe95960805e85519f1cd4389f2cb4cbb7652f"
|
||||
|
||||
user-home@^1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "http://registry.npm.taobao.org/user-home/download/user-home-1.1.1.tgz#2b5be23a32b63a7c9deb8d0f28d485724a3df190"
|
||||
|
Loading…
Reference in New Issue
Block a user