mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2024-11-27 05:39:55 +08:00
add laravel/browser-kit-testing
This commit is contained in:
parent
68d3fb1eb4
commit
d3486f3a40
@ -20,8 +20,7 @@
|
||||
"mockery/mockery": "0.9.*",
|
||||
"phpdocumentor/reflection-docblock": "3.2.2",
|
||||
"phpunit/phpunit": "~5.7",
|
||||
"symfony/css-selector": "3.1.*",
|
||||
"symfony/dom-crawler": "3.1.*",
|
||||
"laravel/browser-kit-testing": "~1.0",
|
||||
"barryvdh/laravel-debugbar": "^2.3",
|
||||
"league/flysystem-memory": "^1.0",
|
||||
"mikey179/vfsStream": "1.6.4"
|
||||
|
80
composer.lock
generated
80
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "bdfd323c0126b7c8fbedf3796f689e6f",
|
||||
"content-hash": "9c5a5336371d87866b6f227ad1b4cdad",
|
||||
"packages": [
|
||||
{
|
||||
"name": "composer/semver",
|
||||
@ -1246,25 +1246,25 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/css-selector",
|
||||
"version": "v3.1.10",
|
||||
"version": "v3.4.12",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/css-selector.git",
|
||||
"reference": "722a87478a72d95dc2a3bcf41dc9c2d13fd4cb2d"
|
||||
"reference": "d2ce52290b648ae33b5301d09bc14ee378612914"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/css-selector/zipball/722a87478a72d95dc2a3bcf41dc9c2d13fd4cb2d",
|
||||
"reference": "722a87478a72d95dc2a3bcf41dc9c2d13fd4cb2d",
|
||||
"url": "https://api.github.com/repos/symfony/css-selector/zipball/d2ce52290b648ae33b5301d09bc14ee378612914",
|
||||
"reference": "d2ce52290b648ae33b5301d09bc14ee378612914",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.5.9"
|
||||
"php": "^5.5.9|>=7.0.8"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.1-dev"
|
||||
"dev-master": "3.4-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@ -1295,7 +1295,7 @@
|
||||
],
|
||||
"description": "Symfony CssSelector Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-01-02T20:31:54+00:00"
|
||||
"time": "2018-05-16T12:49:49+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/debug",
|
||||
@ -2401,6 +2401,53 @@
|
||||
],
|
||||
"time": "2015-05-11T14:41:42+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel/browser-kit-testing",
|
||||
"version": "v1.0.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/laravel/browser-kit-testing.git",
|
||||
"reference": "0adfb725147815bff5516d157577f375a6e66ebd"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/laravel/browser-kit-testing/zipball/0adfb725147815bff5516d157577f375a6e66ebd",
|
||||
"reference": "0adfb725147815bff5516d157577f375a6e66ebd",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.5.9",
|
||||
"symfony/css-selector": "~3.1",
|
||||
"symfony/dom-crawler": "~3.1"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Laravel\\BrowserKitTesting\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Taylor Otwell",
|
||||
"email": "taylor@laravel.com"
|
||||
}
|
||||
],
|
||||
"description": "Provides backwards compatibility for BrowserKit testing in Laravel 5.4.",
|
||||
"keywords": [
|
||||
"laravel",
|
||||
"testing"
|
||||
],
|
||||
"time": "2017-02-08T22:32:37+00:00"
|
||||
},
|
||||
{
|
||||
"name": "league/flysystem-memory",
|
||||
"version": "1.0.1",
|
||||
@ -3786,24 +3833,25 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/dom-crawler",
|
||||
"version": "v3.1.10",
|
||||
"version": "v3.4.12",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/dom-crawler.git",
|
||||
"reference": "7eede2a901a19928494194f7d1815a77b9a473a0"
|
||||
"reference": "201b210fafcdd193c1e45b2994bf7133fb6263e8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/7eede2a901a19928494194f7d1815a77b9a473a0",
|
||||
"reference": "7eede2a901a19928494194f7d1815a77b9a473a0",
|
||||
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/201b210fafcdd193c1e45b2994bf7133fb6263e8",
|
||||
"reference": "201b210fafcdd193c1e45b2994bf7133fb6263e8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.5.9",
|
||||
"php": "^5.5.9|>=7.0.8",
|
||||
"symfony/polyfill-ctype": "~1.8",
|
||||
"symfony/polyfill-mbstring": "~1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/css-selector": "~2.8|~3.0"
|
||||
"symfony/css-selector": "~2.8|~3.0|~4.0"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/css-selector": ""
|
||||
@ -3811,7 +3859,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.1-dev"
|
||||
"dev-master": "3.4-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@ -3838,7 +3886,7 @@
|
||||
],
|
||||
"description": "Symfony DomCrawler Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2017-01-21T17:13:55+00:00"
|
||||
"time": "2018-05-01T22:53:27+00:00"
|
||||
},
|
||||
{
|
||||
"name": "webmozart/assert",
|
||||
|
53
tests/BrowserKitTestCase.php
Normal file
53
tests/BrowserKitTestCase.php
Normal file
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
class BrowserKitTestCase extends Laravel\BrowserKitTesting\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();
|
||||
|
||||
Artisan::call('migrate:refresh');
|
||||
|
||||
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
|
||||
|
||||
return $app;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \App\Models\User|string $role
|
||||
* @return $this
|
||||
*/
|
||||
public function actAs($role)
|
||||
{
|
||||
if (is_string($role)) {
|
||||
if ($role == 'normal') {
|
||||
$role = factory(\App\Models\User::class)->create();
|
||||
} else {
|
||||
$role = factory(\App\Models\User::class, $role)->create();
|
||||
}
|
||||
}
|
||||
return $this->withSession(['uid' => $role->uid, 'token' => $role->getToken()]);
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
{
|
||||
$this->beforeApplicationDestroyed(function () {
|
||||
DB::disconnect();
|
||||
});
|
||||
parent::tearDown();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user