Verified Commit a8e654d8 authored by Korko's avatar Korko
Browse files

Laravel 8.0

parent a32b15e6
Pipeline #377203 failed with stages
in 2 minutes and 14 seconds
......@@ -6,6 +6,7 @@ APP_URL=http://localhost
APP_EMAIL=
LOG_CHANNEL=stack
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_DATABASE=laravel
......
......@@ -6,6 +6,7 @@
.env
.env.backup
.phpunit.result.cache
docker-compose.override.yml
Homestead.json
Homestead.yaml
npm-debug.log
......
......@@ -59,31 +59,10 @@ phpunit:
expire_in: 7 days
when: always
dusk-main:
stage: tests
script:
- BROWSERSTACK_BROWSER=WINDOWS_10_CHROME php artisan dusk
- BROWSERSTACK_BROWSER=WINDOWS_10_FIREFOX php artisan dusk
- BROWSERSTACK_BROWSER=WINDOWS_7_CHROME php artisan dusk
- BROWSERSTACK_BROWSER=WINDOWS_7_FIREFOX php artisan dusk
- BROWSERSTACK_BROWSER=MACOS_CATALINA_CHROME php artisan dusk
- BROWSERSTACK_BROWSER=MACOS_CATALINA_FIREFOX php artisan dusk
artifacts:
paths:
- ./storage/logs # for debugging
- ./tests/Browser/screenshots
- ./tests/Browser/console
expire_in: 7 days
when: always
dusk:
stage: tests
script:
- BROWSERSTACK_BROWSER=WINDOWS_10_EDGE php artisan dusk
- BROWSERSTACK_BROWSER=WINDOWS_10_IE php artisan dusk
- BROWSERSTACK_BROWSER=MACOS_CATALINA_SAFARI php artisan dusk
- BROWSERSTACK_BROWSER=MACOS_CATALINA_EDGE php artisan dusk
allow_failure: true
- php artisan dusk
artifacts:
paths:
- ./storage/logs # for debugging
......
......@@ -44,7 +44,6 @@ class Kernel extends HttpKernel
* @var array
*/
protected $routeMiddleware = [
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
......
......@@ -2,11 +2,11 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use App\Casts\EncryptedString;
use DateInterval;
use DateTime;
use DB;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Draw extends Model
......
......@@ -2,8 +2,8 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Bus\DispatchesJobs;
......
......@@ -2,9 +2,9 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use App\Casts\EncryptedString;
use App\Collections\ParticipantsCollection;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
......
......@@ -4,58 +4,44 @@ namespace App\Providers;
use App\Models\Draw;
use App\Models\Participant;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider
{
/**
* This namespace is applied to your controller routes.
*
* In addition, it is set as the URL generator's root namespace.
*
* @var string
*/
protected $namespace = 'App\Http\Controllers';
/**
* Define the routes for the application.
* Define your route model bindings, pattern filters, etc.
*
* @return void
*/
public function map()
public function boot()
{
$this->mapApiRoutes();
$this->configureRateLimiting();
$this->mapWebRoutes();
}
$this->routes(function () {
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
/**
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*
* @return void
*/
protected function mapWebRoutes()
{
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
});
}
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless.
* Configure the rate limiters for the application.
*
* @return void
*/
protected function mapApiRoutes()
protected function configureRateLimiting()
{
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
});
}
}
......@@ -14,7 +14,7 @@
"fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"korko/laravel-dkim": "^0.6.2",
"korko/laravel-dkim": "dev-master",
"korko/validator": "dev-master",
"laravel/framework": "^8.18",
"laravel/tinker": "^2.5",
......@@ -26,14 +26,14 @@
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.5",
"chinleung/laravel-browserstack": "dev-master",
"facade/ignition": "^2.5",
"martinlindhe/laravel-vue-i18n-generator": "^0.1.46",
"fakerphp/faker": "^1.9.1",
"laravel/sail": "^1.0.1",
"matt-allan/laravel-code-style": "dev-master",
"martinlindhe/laravel-vue-i18n-generator": "dev-master",
"mockery/mockery": "^1.4.2",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.3.3",
"fakerphp/faker": "^1.9.1"
"phpunit/phpunit": "^9.3.3"
},
"config": {
"optimize-autoloader": true,
......@@ -50,8 +50,7 @@
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
},
"files": []
}
},
"minimum-stability": "dev",
"prefer-stable": true,
......@@ -81,7 +80,7 @@
},
{
"type": "vcs",
"url": "https://github.com/korko/laravel-browserstack"
"url": "https://github.com/korko/laravel-vue-i18n-generator"
}
]
}
This diff is collapsed.
......@@ -241,7 +241,6 @@ return [
'Password' => Illuminate\Support\Facades\Password::class,
'Queue' => Illuminate\Support\Facades\Queue::class,
'Redirect' => Illuminate\Support\Facades\Redirect::class,
'Redis' => Illuminate\Support\Facades\Redis::class,
'Request' => Illuminate\Support\Facades\Request::class,
'Response' => Illuminate\Support\Facades\Response::class,
'Route' => Illuminate\Support\Facades\Route::class,
......
use Illuminate\Database\Eloquent\Factories\Factory;
namespace Database\Factories;
<?php
namespace Database\Factories;
use App\Models\Draw;
use Illuminate\Database\Eloquent\Factories\Factory;
class DrawFactory extends Factory
......@@ -9,7 +12,7 @@ class DrawFactory extends Factory
*
* @var string
*/
protected $model = \App\Models\Draw::class;
protected $model = Draw::class;
/**
* Define the model's default state.
......
<?php
namespace Database\Factories;
use App\Models\Draw;
use App\Models\Mail as MailModel;
use Illuminate\Database\Eloquent\Factories\Factory;
class MailFactory extends Factory
......@@ -9,7 +13,7 @@ class MailFactory extends Factory
*
* @var string
*/
protected $model = \App\Models\Mail::class;
protected $model = MailModel::class;
/**
* Define the model's default state.
......@@ -19,8 +23,8 @@ class MailFactory extends Factory
public function definition()
{
return [
'delivery_status' => App\Models\Mail::CREATED,
'draw_id' => \App\Models\Draw::factory(),
'delivery_status' => MailModel::CREATED,
'draw_id' => Draw::factory(),
'version' => $this->faker->numberBetween(0, 255),
];
}
......
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Database\Eloquent\Factories\Factory;
/*
|--------------------------------------------------------------------------
......
<?php
namespace Database\Factories;
use App\Models\Draw;
use App\Models\Mail as MailModel;
use App\Models\Participant;
use Illuminate\Database\Eloquent\Factories\Factory;
class ParticipantFactory extends Factory
......@@ -9,7 +14,7 @@ class ParticipantFactory extends Factory
*
* @var string
*/
protected $model = \App\Models\Participant::class;
protected $model = Participant::class;
/**
* Define the model's default state.
......@@ -19,11 +24,11 @@ class ParticipantFactory extends Factory
public function definition()
{
return [
'draw_id' => \App\Models\Draw::factory(),
'draw_id' => Draw::factory(),
'name' => $this->faker->name,
'email' => $this->faker->email,
'target_id' => null,
'mail_id' => \App\Models\Mail::factory(),
'mail_id' => MailModel::factory(),
];
}
}
......@@ -15,6 +15,7 @@ class CreateFailedJobsTable extends Migration
{
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
......
# For more information: https://laravel.com/docs/sail
version: '3'
services:
laravel.test:
build:
context: ./vendor/laravel/sail/runtimes/8.0
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
image: sail-8.0/app
ports:
- '${APP_PORT:-80}:80'
environment:
WWWUSER: '${WWWUSER}'
LARAVEL_SAIL: 1
volumes:
- '.:/var/www/html'
networks:
- sail
depends_on:
- mysql
- redis
# - selenium
# selenium:
# image: 'selenium/standalone-chrome'
# volumes:
# - '/dev/shm:/dev/shm'
# networks:
# - sail
# depends_on:
# - laravel.test
mysql:
image: 'mysql:8.0'
ports:
- '${FORWARD_DB_PORT:-3306}:3306'
environment:
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
MYSQL_DATABASE: '${DB_DATABASE}'
MYSQL_USER: '${DB_USERNAME}'
MYSQL_PASSWORD: '${DB_PASSWORD}'
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
volumes:
- 'sailmysql:/var/lib/mysql'
networks:
- sail
redis:
image: 'redis:alpine'
ports:
- '${FORWARD_REDIS_PORT:-6379}:6379'
volumes:
- 'sailredis:/data'
networks:
- sail
# memcached:
# image: 'memcached:alpine'
# ports:
# - '11211:11211'
# networks:
# - sail
mailhog:
image: 'mailhog/mailhog:latest'
ports:
- 1025:1025
- 8025:8025
networks:
- sail
networks:
sail:
driver: bridge
volumes:
sailmysql:
driver: local
sailredis:
driver: local
<?php
/**
* Laravel - A PHP Framework For Web Artisans.
*
* @author Taylor Otwell <taylor@laravel.com>
*/
use Illuminate\Contracts\Http\Kernel;
use Illuminate\Http\Request;
define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
| Check If Application Is Under Maintenance
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| our application. We just need to utilize it! We'll simply require it
| into the script here so that we don't have to worry about manual
| loading any of our classes later on. It feels great to relax.
| If the application is maintenance / demo mode via the "down" command we
| will require this file so that any prerendered template can be shown
| instead of starting the framework, which could cause an exception.
|
*/
require __DIR__.'/../vendor/autoload.php';
if (file_exists(__DIR__.'/../storage/framework/maintenance.php')) {
require __DIR__.'/../storage/framework/maintenance.php';
}
/*
|--------------------------------------------------------------------------
| Turn On The Lights
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
| Composer provides a convenient, automatically generated class loader for
| this application. We just need to utilize it! We'll simply require it
| into the script here so we don't need to manually load our classes.
|
*/
$app = require_once __DIR__.'/../bootstrap/app.php';
require __DIR__.'/../vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request
| through the kernel, and send the associated response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
| Once we have the application, we can handle the incoming request using
| the application's HTTP kernel. Then, we will send the response back
| to this client's browser, allowing them to enjoy our application.
|
*/
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$app = require_once __DIR__.'/../bootstrap/app.php';
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
$kernel = $app->make(Kernel::class);
$response->send();
$response = tap($kernel->handle(
$request = Request::capture()
))->send();
$kernel->terminate($request, $response);
......@@ -2,7 +2,6 @@
namespace Tests;
use ChinLeung\BrowserStack\RunsOnBrowserStack;
use Facebook\WebDriver\Chrome\ChromeOptions;
use Facebook\WebDriver\Remote\DesiredCapabilities;
use Facebook\WebDriver\Remote\RemoteWebDriver;
......@@ -10,5 +9,5 @@ use Laravel\Dusk\TestCase as BaseTestCase;
abstract class DuskTestCase extends BaseTestCase
{
use CreatesApplication, RunsOnBrowserStack;
use CreatesApplication;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment