Laravel 5.4

This commit is contained in:
Adam Lavin 2017-11-28 05:44:31 +00:00
parent 61ee103299
commit 0cc03b509b
19 changed files with 1109 additions and 1074 deletions

1
.gitignore vendored
View file

@ -1,6 +1,7 @@
/vendor
/node_modules
/public/build
/public/hot
/logs
Homestead.yaml
/public/storage

View file

@ -74,7 +74,7 @@ class Handler extends ExceptionHandler
if ($request->expectsJson()) {
return response()->json(['error' => 'Unauthenticated.'], 401);
} else {
return redirect()->guest('login');
return redirect()->guest(route('login'));
}
}
}

View file

@ -19,7 +19,7 @@ class BroadcastServiceProvider extends ServiceProvider
/*
* Authenticate the user's personal channel...
*/
Broadcast::channel('App.User.*', function ($user, $userId) {
Broadcast::channel('App.User.{userId}', function ($user, $userId) {
return (int) $user->id === (int) $userId;
});
}

View file

@ -20,7 +20,6 @@
namespace Poniverse\Ponyfm\Providers;
use Illuminate\Contracts\Events\Dispatcher as DispatcherContract;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
class EventServiceProvider extends ServiceProvider
@ -31,7 +30,7 @@ class EventServiceProvider extends ServiceProvider
* @var array
*/
protected $listen = [
'Poniverse\Ponyfm\Events\SomeEvent' => [
'Poniverse\Ponyfm\Events\Event' => [
'Poniverse\Ponyfm\Listeners\EventListener',
],
];

View file

@ -15,20 +15,3 @@ define('LARAVEL_START', microtime(true));
*/
require __DIR__.'/../vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Include The Compiled Class File
|--------------------------------------------------------------------------
|
| To dramatically increase your application's performance, you may use a
| compiled class file which contains all of the classes commonly used
| by a request. The Artisan "optimize" is used to create this file.
|
*/
$compiledPath = __DIR__.'/cache/compiled.php';
if (file_exists($compiledPath)) {
require $compiledPath;
}

View file

@ -11,7 +11,7 @@
"type": "project",
"require": {
"php": ">=7.0.1",
"laravel/framework": "5.3.*",
"laravel/framework": "5.4.*",
"codescale/ffmpeg-php": "2.7.0",
"intouch/laravel-newrelic": "*",
"barryvdh/laravel-ide-helper": "^2.1",
@ -20,14 +20,15 @@
"venturecraft/revisionable": "^1.23",
"pda/pheanstalk": "~3.0",
"cviebrock/laravel-elasticsearch": "^1.0",
"barryvdh/laravel-debugbar": "^2.2",
"barryvdh/laravel-debugbar": "~2.4",
"predis/predis": "^1.0",
"ksubileau/color-thief-php": "^1.3",
"graham-campbell/exceptions": "^9.1",
"minishlink/web-push": "^1.0",
"alsofronie/eloquent-uuid": "^1.0",
"poniverse/api": "dev-rewrite",
"barryvdh/laravel-cors": "^0.8.2"
"barryvdh/laravel-cors": "^0.8.2",
"laravel/tinker": "^1.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
@ -36,7 +37,9 @@
"phpspec/phpspec": "~2.1",
"filp/whoops": "^2.1",
"symfony/dom-crawler": "~3.1",
"symfony/css-selector": "~3.1"
"symfony/css-selector": "~3.1",
"laravel/browser-kit-testing": "1.*",
"nategood/httpful": "^0.2.20"
},
"autoload": {
"classmap": [
@ -50,9 +53,9 @@
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-install-cmd": [

1888
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -12,7 +12,8 @@ return [
| any other location as required by the application or its packages.
*/
'name' => 'My Application',
'name' => env('APP_NAME', 'My Application'),
'env' => env('APP_ENV', 'production'),
@ -164,6 +165,7 @@ return [
Poniverse\Ponyfm\Providers\AuthServiceProvider::class,
Poniverse\Ponyfm\Providers\NotificationServiceProvider::class,
Laravel\Tinker\TinkerServiceProvider::class,
Intouch\LaravelNewrelic\NewrelicServiceProvider::class,
Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class,
Cviebrock\LaravelElasticsearch\ServiceProvider::class,

View file

@ -46,7 +46,7 @@ return [
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache'),
'path' => storage_path('framework/cache/data'),
],
'memcached' => [

View file

@ -1,35 +0,0 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Additional Compiled Classes
|--------------------------------------------------------------------------
|
| Here you may specify additional classes to include in the compiled file
| generated by the `artisan optimize` command. These should be classes
| that are included on basically every request into the application.
|
*/
'files' => [
//
],
/*
|--------------------------------------------------------------------------
| Compiled File Providers
|--------------------------------------------------------------------------
|
| Here you may list service providers which define a "compiles" function
| that returns additional files that should be compiled, providing an
| easy way to get common files from any packages you are utilizing.
|
*/
'providers' => [
//
],
];

View file

@ -2,19 +2,6 @@
return [
/*
|--------------------------------------------------------------------------
| PDO Fetch Style
|--------------------------------------------------------------------------
|
| By default, database results will be returned as instances of the PHP
| stdClass object; however, you may desire to retrieve records in an
| array format for simplicity. Here you can tweak the fetch style.
|
*/
'fetch' => PDO::FETCH_CLASS,
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
@ -64,8 +51,9 @@ return [
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => false,
],
@ -119,13 +107,21 @@ return [
'redis' => [
'cluster' => false,
'client' => 'predis',
'default' => [
'host' => env('REDIS_HOST', 'localhost'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => 0,
'options' => [
'cluster' => 'redis',
],
'clusters' => [
'default' => [
[
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => 0,
],
],
],
],

View file

@ -12,7 +12,7 @@ return [
|
*/
'enabled' => null,
'enabled' => env('DEBUGBAR_ENABLED', null),
/*
|--------------------------------------------------------------------------
@ -27,10 +27,11 @@ return [
|
*/
'storage' => [
'enabled' => true,
'driver' => 'redis', // redis, file, pdo
'path' => storage_path() . '/debugbar', // For file driver
'enabled' => true,
'driver' => 'file', // redis, file, pdo, custom
'path' => storage_path('debugbar'), // For file driver
'connection' => null, // Leave null for default connection (Redis/PDO)
'provider' => '' // Instance of StorageInterface for custom driver
],
/*
@ -57,9 +58,22 @@ return [
| The Debugbar can capture Ajax requests and display them. If you don't want this (ie. because of errors),
| you can use this option to disable sending the data through the headers.
|
| Optionally, you can also send ServerTiming headers on ajax requests for the Chrome DevTools.
*/
'capture_ajax' => true,
'add_ajax_timing' => false,
/*
|--------------------------------------------------------------------------
| Custom Error Handler for Deprecated warnings
|--------------------------------------------------------------------------
|
| When enabled, the Debugbar shows deprecated warnings for Symfony components
| in the Messages tab.
|
*/
'error_handler' => false,
/*
|--------------------------------------------------------------------------
@ -91,17 +105,18 @@ return [
'db' => true, // Show database (PDO) queries and bindings
'views' => true, // Views with their data
'route' => true, // Current route information
'auth' => true, // Display Laravel authentication status
'gate' => true, // Display Laravel Gate checks
'session' => true, // Display session data
'symfony_request' => true, // Only one can be enabled..
'mail' => true, // Catch mail messages
'laravel' => false, // Laravel version and environment
'events' => false, // All events fired
'default_request' => false, // Regular or special Symfony request logger
'symfony_request' => true, // Only one can be enabled..
'mail' => true, // Catch mail messages
'logs' => false, // Add the latest log messages
'files' => false, // Show the included files
'config' => false, // Display config settings
'auth' => false, // Display Laravel authentication status
'gate' => false, // Display Laravel Gate checks
'session' => true, // Display session data
'cache' => false, // Display cache events
],
/*
@ -119,11 +134,11 @@ return [
],
'db' => [
'with_params' => true, // Render SQL with the parameters substituted
'backtrace' => true, // Use a backtrace to find the origin of the query in your files.
'timeline' => false, // Add the queries to the timeline
'backtrace' => false, // EXPERIMENTAL: Use a backtrace to find the origin of the query in your files.
'explain' => [ // EXPERIMENTAL: Show EXPLAIN output on queries
'explain' => [ // Show EXPLAIN output on queries
'enabled' => false,
'types' => ['SELECT'], // array('SELECT', 'INSERT', 'UPDATE', 'DELETE'); for MySQL 5.6.3+
'types' => ['SELECT'], // ['SELECT', 'INSERT', 'UPDATE', 'DELETE']; for MySQL 5.6.3+
],
'hints' => true, // Show hints for common mistakes
],
@ -139,6 +154,9 @@ return [
'logs' => [
'file' => null
],
'cache' => [
'values' => true // collect cache values
],
],
/*
@ -146,7 +164,7 @@ return [
| Inject Debugbar in Response
|--------------------------------------------------------------------------
|
| Usually, the debugbar is added just before <body>, by listening to the
| Usually, the debugbar is added just before </body>, by listening to the
| Response after the App is done. If you disable this, you have to add them
| in your template yourself. See http://phpdebugbar.com/docs/rendering.html
|
@ -166,4 +184,13 @@ return [
*/
'route_prefix' => '_debugbar',
/*
|--------------------------------------------------------------------------
| DebugBar route domain
|--------------------------------------------------------------------------
|
| By default DebugBar route served from the same domain that request served.
| To override default domain, specify it as a non-empty value.
*/
'route_domain' => null,
];

View file

@ -8,10 +8,8 @@ return [
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. A "local" driver, as well as a variety of cloud
| based drivers are available for your choosing. Just store away!
|
| Supported: "local", "ftp", "s3", "rackspace"
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
*/
@ -39,6 +37,8 @@ return [
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "s3", "rackspace"
|
*/
'disks' => [
@ -53,36 +53,19 @@ return [
'root' => storage_path('app').'/test-files',
],
'ftp' => [
'driver' => 'ftp',
'host' => 'ftp.example.com',
'username' => 'your-username',
'password' => 'your-password',
// Optional FTP Settings...
// 'port' => 21,
// 'root' => '',
// 'passive' => true,
// 'ssl' => true,
// 'timeout' => 30,
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => 'your-key',
'secret' => 'your-secret',
'region' => 'your-region',
'bucket' => 'your-bucket',
],
'rackspace' => [
'driver' => 'rackspace',
'username' => 'your-username',
'key' => 'your-key',
'container' => 'your-container',
'endpoint' => 'https://identity.api.rackspacecloud.com/v2.0/',
'region' => 'IAD',
'url_type' => 'publicURL',
'key' => env('AWS_KEY'),
'secret' => env('AWS_SECRET'),
'region' => env('AWS_REGION'),
'bucket' => env('AWS_BUCKET'),
],
],

View file

@ -11,7 +11,8 @@ return [
| sending of e-mail. You may specify which one you're using throughout
| your application here. By default, Laravel is setup for SMTP mail.
|
| Supported: "smtp", "mail", "sendmail", "mailgun", "mandrill", "ses", "log"
| Supported: "smtp", "sendmail", "mailgun", "mandrill", "ses",
| "sparkpost", "log", "array"
|
*/
@ -54,7 +55,10 @@ return [
|
*/
'from' => ['address' => 'hello@pony.fm', 'name' => 'Pony.fm'],
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@pony.fm'),
'name' => env('MAIL_FROM_NAME', 'Pony.fm'),
],
/*
|--------------------------------------------------------------------------
@ -82,17 +86,6 @@ return [
'username' => env('MAIL_USERNAME'),
/*
|--------------------------------------------------------------------------
| SMTP Server Password
|--------------------------------------------------------------------------
|
| Here you may set the password required by your SMTP server to send out
| messages from your application. This will be given to the server on
| connection so that the application will be able to send messages.
|
*/
'password' => env('MAIL_PASSWORD'),
/*
@ -108,5 +101,23 @@ return [
'sendmail' => '/usr/sbin/sendmail -bs',
/*
|--------------------------------------------------------------------------
| Markdown Mail Settings
|--------------------------------------------------------------------------
|
| If you are using Markdown based email rendering, you may configure your
| theme and component paths here, allowing you to customize the design
| of the emails. Or, you may simply stick with the Laravel defaults!
|
*/
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
];

View file

@ -14,7 +14,7 @@ return [
*/
'paths' => [
realpath(base_path('resources/views')),
resource_path('views'),
],
/*

View file

@ -4,7 +4,7 @@
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @author Taylor Otwell <taylorotwell@gmail.com>
* @author Taylor Otwell <taylor@laravel.com>
*/
/*
@ -15,7 +15,7 @@
| 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 nice to relax.
| loading any of our classes later on. It feels great to relax.
|
*/

View file

@ -1,5 +1,7 @@
<?php
namespace Tests;
/**
* Pony.fm - A community for pony fan music.
* Copyright (C) 2015 Peter Deltchev
@ -40,7 +42,7 @@ class ApiAuthTest extends TestCase
$accessTokenInfo->setIsActive(true);
$accessTokenInfo->setScopes(['basic', 'ponyfm:tracks:upload']);
$poniverse = Mockery::mock('overload:Poniverse\Lib\OAuth2\PoniverseProvider');
$poniverse = \Mockery::mock('overload:Poniverse\Lib\OAuth2\PoniverseProvider');
$poniverse->shouldReceive('getResourceOwner')
->andReturn(new \Poniverse\Lib\Entity\Poniverse\User([
'id' => $user->id,
@ -50,7 +52,7 @@ class ApiAuthTest extends TestCase
]));
$poniverse->shouldReceive('setAccessToken');
$accessTokenService = Mockery::mock('overload:Poniverse\Lib\Service\Poniverse\Meta');
$accessTokenService = \Mockery::mock('overload:Poniverse\Lib\Service\Poniverse\Meta');
$accessTokenService->shouldReceive('introspect')
->andReturn($accessTokenInfo);
@ -68,7 +70,7 @@ class ApiAuthTest extends TestCase
$accessTokenInfo->setClientId('Unicorns and rainbows');
$accessTokenInfo->setScopes(['basic', 'ponyfm:tracks:upload']);
$poniverse = Mockery::mock('overload:Poniverse\Lib\OAuth2\PoniverseProvider');
$poniverse = \Mockery::mock('overload:Poniverse\Lib\OAuth2\PoniverseProvider');
$poniverse->shouldReceive('getResourceOwner')
->andReturn(new \Poniverse\Lib\Entity\Poniverse\User([
'id' => $user->id,
@ -78,7 +80,7 @@ class ApiAuthTest extends TestCase
]));
$poniverse->shouldReceive('setAccessToken');
$accessTokenService = Mockery::mock('overload:Poniverse\Lib\Service\Poniverse\Meta');
$accessTokenService = \Mockery::mock('overload:Poniverse\Lib\Service\Poniverse\Meta');
$accessTokenService
->shouldReceive('introspect')
->andReturn($accessTokenInfo);

View file

@ -1,5 +1,7 @@
<?php
namespace Tests;
/**
* Pony.fm - A community for pony fan music.
* Copyright (C) 2015-2017 Peter Deltchev

View file

@ -1,4 +1,9 @@
<?php
namespace Tests;
use Illuminate\Contracts\Console\Kernel;
use Laravel\BrowserKitTesting\TestCase as BaseTestCase;
use Poniverse\Ponyfm\Models\User;
/**
@ -19,7 +24,7 @@ use Poniverse\Ponyfm\Models\User;
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class TestCase extends Illuminate\Foundation\Testing\TestCase
class TestCase extends BaseTestCase
{
/**
* The base URL to use while testing the application.
@ -46,7 +51,7 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
{
$app = require __DIR__.'/../bootstrap/app.php';
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
$app->make(Kernel::class)->bootstrap();
return $app;
}
@ -58,8 +63,8 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
{
// Ensure we have the Pony.fm test files
if (!static::$initializedFiles) {
Storage::disk('local')->makeDirectory('test-files');
$storage = Storage::disk('testing');
\Storage::disk('local')->makeDirectory('test-files');
$storage = \Storage::disk('testing');
// To add new test files, upload them to poniverse.net/files
// and add them here with their last-modified date as a Unix
@ -102,7 +107,7 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
public function tearDown()
{
Storage::disk('local')->deleteDirectory('testing-datastore');
\Storage::disk('local')->deleteDirectory('testing-datastore');
parent::tearDown();
}
@ -120,8 +125,8 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
*/
public function getTestFileForUpload($filename)
{
Storage::disk('local')->makeDirectory('testing-datastore/tmp');
Storage::disk('local')->copy("test-files/${filename}", "testing-datastore/tmp/${filename}");
\Storage::disk('local')->makeDirectory('testing-datastore/tmp');
\Storage::disk('local')->copy("test-files/${filename}", "testing-datastore/tmp/${filename}");
return new \Illuminate\Http\UploadedFile(storage_path("app/testing-datastore/tmp/${filename}"), $filename, null, null, null, true);
}
@ -135,8 +140,8 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
protected function callUploadWithParameters(array $parameters, array $files = [])
{
$this->expectsJobs([
Poniverse\Ponyfm\Jobs\EncodeTrackFile::class,
Poniverse\Ponyfm\Jobs\UpdateSearchIndexForEntity::class
\Poniverse\Ponyfm\Jobs\EncodeTrackFile::class,
\Poniverse\Ponyfm\Jobs\UpdateSearchIndexForEntity::class
]);
$this->user = factory(User::class)->create();