From a488b9c8155eb14c681037a919e6c5984c11b643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Till=20Kru=CC=88ss?= Date: Mon, 15 Jan 2018 09:15:43 -0800 Subject: [PATCH 01/10] tag v5.5.29 release notes --- CHANGELOG-5.5.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG-5.5.md b/CHANGELOG-5.5.md index b7251c3e1ea6..44981273d632 100644 --- a/CHANGELOG-5.5.md +++ b/CHANGELOG-5.5.md @@ -1,6 +1,6 @@ # Release Notes for 5.5.x -## [Unreleased] +## v5.5.29 (2018-01-15) ### Added - Added `Model::qualifyColumn()` method ([#22577](https://github.com/laravel/framework/pull/22577)) @@ -23,6 +23,7 @@ - Set `null` as default value for `optional()` helper ([#22699](https://github.com/laravel/framework/pull/22699)) - Make sure `getRememberToken()` returns a string ([#22724](https://github.com/laravel/framework/pull/22724)) - Updated Vue preset version ([#22732](https://github.com/laravel/framework/pull/22732)) +- Accept `Arrayable` items in `Collection::find()` ([#22787](https://github.com/laravel/framework/pull/22787)) ### Fixed - Close database connection when using `RefreshDatabase` trait ([#22569](https://github.com/laravel/framework/pull/22569)) @@ -30,6 +31,9 @@ - Fixed parameter usage in `RedirectController` ([#22657](https://github.com/laravel/framework/pull/22657)) - Added `__set_state()` method to `Support/Carbon` ([#22689](https://github.com/laravel/framework/pull/22689)) - Do not continue checking `APP_ENV` if environment file path being set successfully with `--env` option ([#22753](https://github.com/laravel/framework/pull/22753)) +- Fixed missing table prefix in `SQLiteGrammar::compileDropColumn()` ([#22745](https://github.com/laravel/framework/pull/22745), [c13322c](https://github.com/laravel/framework/commit/c13322c54a20de1417d7bf53e348a601c526bf54)) +- Fixed prefixing in `SQLiteGrammar::compileColumnListing()` ([#22781](https://github.com/laravel/framework/pull/22781)) + ## v5.5.28 (2017-12-26) From 1f20e5f369a4089d4237f1a134c8a7490ece146d Mon Sep 17 00:00:00 2001 From: Jesse Denardo Date: Mon, 15 Jan 2018 14:34:10 -0500 Subject: [PATCH 02/10] Fix Collection dd() in browser preview window (#22803) See https://github.com/laravel/framework/pull/22581 --- src/Illuminate/Support/Collection.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Illuminate/Support/Collection.php b/src/Illuminate/Support/Collection.php index d95271d35e15..276c650ed7fc 100644 --- a/src/Illuminate/Support/Collection.php +++ b/src/Illuminate/Support/Collection.php @@ -271,6 +271,8 @@ public function crossJoin(...$lists) */ public function dd(...$args) { + http_response_code(500); + call_user_func_array([$this, 'dump'], $args); die(1); From ff11fd7205431e31837538cc86c8e4dd4917bddb Mon Sep 17 00:00:00 2001 From: Ahmed Mohamed Abd El Ftah Date: Tue, 16 Jan 2018 03:08:46 +0200 Subject: [PATCH 03/10] [5.5] Allow only to accept collection of keys (#22804) * Modify only to accept collection of keys * Fix missing parentethes --- src/Illuminate/Support/Collection.php | 4 ++++ tests/Support/SupportCollectionTest.php | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/Illuminate/Support/Collection.php b/src/Illuminate/Support/Collection.php index 276c650ed7fc..005a088182a3 100644 --- a/src/Illuminate/Support/Collection.php +++ b/src/Illuminate/Support/Collection.php @@ -1062,6 +1062,10 @@ public function only($keys) return new static($this->items); } + if ($keys instanceof self) { + $keys = $keys->all(); + } + $keys = is_array($keys) ? $keys : func_get_args(); return new static(Arr::only($this->items, $keys)); diff --git a/tests/Support/SupportCollectionTest.php b/tests/Support/SupportCollectionTest.php index 1ca56dc74ba4..452de6def9dc 100755 --- a/tests/Support/SupportCollectionTest.php +++ b/tests/Support/SupportCollectionTest.php @@ -1970,9 +1970,11 @@ public function testOnly() $this->assertEquals($data->all(), $data->only(null)->all()); $this->assertEquals(['first' => 'Taylor'], $data->only(['first', 'missing'])->all()); $this->assertEquals(['first' => 'Taylor'], $data->only('first', 'missing')->all()); + $this->assertEquals(['first' => 'Taylor'], $data->only(collect(['first', 'missing']))->all()); $this->assertEquals(['first' => 'Taylor', 'email' => 'taylorotwell@gmail.com'], $data->only(['first', 'email'])->all()); $this->assertEquals(['first' => 'Taylor', 'email' => 'taylorotwell@gmail.com'], $data->only('first', 'email')->all()); + $this->assertEquals(['first' => 'Taylor', 'email' => 'taylorotwell@gmail.com'], $data->only(collect(['first', 'email']))->all()); } public function testGettingAvgItemsFromCollection() From a948d90222dd408c30ee83cf8a530f4e8d677281 Mon Sep 17 00:00:00 2001 From: Timo Schwarzer Date: Tue, 16 Jan 2018 14:39:07 +0100 Subject: [PATCH 04/10] Revert #22649 (#22815) That commit caused unit tests using the actingAs helper to fail --- src/Illuminate/Auth/RequestGuard.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Illuminate/Auth/RequestGuard.php b/src/Illuminate/Auth/RequestGuard.php index d756268d4f9c..2adc2cc35302 100644 --- a/src/Illuminate/Auth/RequestGuard.php +++ b/src/Illuminate/Auth/RequestGuard.php @@ -80,8 +80,6 @@ public function validate(array $credentials = []) */ public function setRequest(Request $request) { - $this->user = null; - $this->request = $request; return $this; From ddd70ddddabf6067b621e220f42977598118846d Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 16 Jan 2018 07:39:24 -0600 Subject: [PATCH 05/10] version --- src/Illuminate/Foundation/Application.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/Application.php b/src/Illuminate/Foundation/Application.php index b43a36073209..16fcf346dc57 100755 --- a/src/Illuminate/Foundation/Application.php +++ b/src/Illuminate/Foundation/Application.php @@ -29,7 +29,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn * * @var string */ - const VERSION = '5.5.29'; + const VERSION = '5.5.30'; /** * The base path for the Laravel installation. From d8a8368e15e73de50b91b903f6b933c7d05b0e28 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 16 Jan 2018 07:43:37 -0600 Subject: [PATCH 06/10] revert breaking change --- src/Illuminate/Support/Collection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Support/Collection.php b/src/Illuminate/Support/Collection.php index 005a088182a3..4536889229dc 100644 --- a/src/Illuminate/Support/Collection.php +++ b/src/Illuminate/Support/Collection.php @@ -393,7 +393,7 @@ public function every($key, $operator = null, $value = null) public function except($keys) { if ($keys instanceof self) { - $keys = $keys->keys()->all(); + $keys = $keys->all(); } elseif (! is_array($keys)) { $keys = func_get_args(); } From 80ef2d0ea836b15c7a45e611d17e9bc24d4bd235 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Tue, 16 Jan 2018 22:17:43 +0800 Subject: [PATCH 07/10] Add actingAs() tests. (#22817) * Add actingAs() tests. Signed-off-by: Mior Muhammad Zaki * Add test for session auth as well. Signed-off-by: Mior Muhammad Zaki --- .../InteractsWithAuthenticationTest.php | 101 ++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 tests/Integration/Foundation/Testing/Concerns/InteractsWithAuthenticationTest.php diff --git a/tests/Integration/Foundation/Testing/Concerns/InteractsWithAuthenticationTest.php b/tests/Integration/Foundation/Testing/Concerns/InteractsWithAuthenticationTest.php new file mode 100644 index 000000000000..0859797c756a --- /dev/null +++ b/tests/Integration/Foundation/Testing/Concerns/InteractsWithAuthenticationTest.php @@ -0,0 +1,101 @@ +set('auth.providers.users.model', AuthenticationTestUser::class); + + $app['config']->set('database.default', 'testbench'); + $app['config']->set('database.connections.testbench', [ + 'driver' => 'sqlite', + 'database' => ':memory:', + 'prefix' => '', + ]); + } + + public function setUp() + { + parent::setUp(); + + Schema::create('users', function ($table) { + $table->increments('id'); + $table->string('email'); + $table->string('username'); + $table->string('password'); + $table->string('remember_token')->default(null)->nullable(); + $table->tinyInteger('is_active')->default(0); + }); + + AuthenticationTestUser::create([ + 'username' => 'taylorotwell', + 'email' => 'taylorotwell@laravel.com', + 'password' => bcrypt('password'), + 'is_active' => true, + ]); + } + + public function test_acting_as_is_properly_handled_for_session_auth() + { + Route::get('me', function (Request $request) { + return 'Hello '.$request->user()->username; + })->middleware(['auth']); + + $user = AuthenticationTestUser::where('username', '=', 'taylorotwell')->first(); + + $this->actingAs($user) + ->get('/me') + ->assertSuccessful() + ->assertSeeText('Hello taylorotwell'); + } + + public function test_acting_as_is_properly_handled_for_auth_via_request() + { + Route::get('me', function (Request $request) { + return 'Hello '.$request->user()->username; + })->middleware(['auth:api']); + + Auth::viaRequest('basic', function ($request) { + return $request->user(); + }); + + $user = AuthenticationTestUser::where('username', '=', 'taylorotwell')->first(); + + $this->actingAs($user, 'api') + ->get('/me') + ->assertSuccessful() + ->assertSeeText('Hello taylorotwell'); + } +} + +class AuthenticationTestUser extends Authenticatable +{ + public $table = 'users'; + public $timestamps = false; + + /** + * The attributes that are mass assignable. + * + * @var array + */ + protected $guarded = ['id']; + + /** + * The attributes that should be hidden for arrays. + * + * @var array + */ + protected $hidden = [ + 'password', 'remember_token', + ]; +} From e09149aaeb5d58b1fabde3a932578479f7ba86fe Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 16 Jan 2018 08:17:56 -0600 Subject: [PATCH 08/10] Apply fixes from StyleCI (#22818) --- .../Testing/Concerns/InteractsWithAuthenticationTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/Integration/Foundation/Testing/Concerns/InteractsWithAuthenticationTest.php b/tests/Integration/Foundation/Testing/Concerns/InteractsWithAuthenticationTest.php index 0859797c756a..19d272fb5fd0 100644 --- a/tests/Integration/Foundation/Testing/Concerns/InteractsWithAuthenticationTest.php +++ b/tests/Integration/Foundation/Testing/Concerns/InteractsWithAuthenticationTest.php @@ -7,7 +7,6 @@ use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Schema; -use Illuminate\Auth\EloquentUserProvider; use Illuminate\Foundation\Auth\User as Authenticatable; class InteractsWithAuthenticationTest extends TestCase From f34926c52ba282ff67f4be3e9afc8d0ddc885c3f Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 16 Jan 2018 09:39:09 -0600 Subject: [PATCH 09/10] fix bugs --- src/Illuminate/Foundation/Application.php | 2 +- tests/Support/SupportCollectionTest.php | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Illuminate/Foundation/Application.php b/src/Illuminate/Foundation/Application.php index 16fcf346dc57..8af1bcea4082 100755 --- a/src/Illuminate/Foundation/Application.php +++ b/src/Illuminate/Foundation/Application.php @@ -29,7 +29,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn * * @var string */ - const VERSION = '5.5.30'; + const VERSION = '5.5.31'; /** * The base path for the Laravel installation. diff --git a/tests/Support/SupportCollectionTest.php b/tests/Support/SupportCollectionTest.php index 452de6def9dc..2591b6c796c5 100755 --- a/tests/Support/SupportCollectionTest.php +++ b/tests/Support/SupportCollectionTest.php @@ -973,11 +973,9 @@ public function testExcept() $this->assertEquals(['first' => 'Taylor'], $data->except(['last', 'email', 'missing'])->all()); $this->assertEquals(['first' => 'Taylor'], $data->except('last', 'email', 'missing')->all()); - $this->assertEquals(['first' => 'Taylor'], $data->except(collect(['last' => 'Otwell', 'email' => 'taylorotwell@gmail.com', 'missing']))->all()); $this->assertEquals(['first' => 'Taylor', 'email' => 'taylorotwell@gmail.com'], $data->except(['last'])->all()); $this->assertEquals(['first' => 'Taylor', 'email' => 'taylorotwell@gmail.com'], $data->except('last')->all()); - $this->assertEquals(['first' => 'Taylor', 'email' => 'taylorotwell@gmail.com'], $data->except(collect(['last' => 'Otwell']))->all()); } public function testPluckWithArrayAndObjectValues() From 98b09bd3aebb44c90f18361ebaea0c2d47cd1603 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Tue, 16 Jan 2018 23:39:33 +0800 Subject: [PATCH 10/10] Small typo, it should be "api", not "basic" (#22819) Signed-off-by: Mior Muhammad Zaki --- .../Testing/Concerns/InteractsWithAuthenticationTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Integration/Foundation/Testing/Concerns/InteractsWithAuthenticationTest.php b/tests/Integration/Foundation/Testing/Concerns/InteractsWithAuthenticationTest.php index 19d272fb5fd0..9bcb15897a4b 100644 --- a/tests/Integration/Foundation/Testing/Concerns/InteractsWithAuthenticationTest.php +++ b/tests/Integration/Foundation/Testing/Concerns/InteractsWithAuthenticationTest.php @@ -64,7 +64,7 @@ public function test_acting_as_is_properly_handled_for_auth_via_request() return 'Hello '.$request->user()->username; })->middleware(['auth:api']); - Auth::viaRequest('basic', function ($request) { + Auth::viaRequest('api', function ($request) { return $request->user(); });