Skip to content

Commit 428f86d

Browse files
committed
Merge branch '10.x' into 11.x
Signed-off-by: Mior Muhammad Zaki <[email protected]>
2 parents 6b2de05 + a2d70b5 commit 428f86d

39 files changed

+151
-275
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
"league/flysystem-sftp-v3": "^3.0",
107107
"mockery/mockery": "^1.6",
108108
"nyholm/psr7": "^1.2",
109-
"orchestra/testbench-core": "^9.0",
109+
"orchestra/testbench-core": "^9.0.6",
110110
"pda/pheanstalk": "^5.0",
111111
"phpstan/phpstan": "^1.4.7",
112112
"phpunit/phpunit": "^10.5|^11.0",

src/Illuminate/Collections/Collection.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -998,8 +998,11 @@ public function push(...$values)
998998
/**
999999
* Push all of the given items onto the collection.
10001000
*
1001-
* @param iterable<array-key, TValue> $source
1002-
* @return static
1001+
* @template TConcatKey of array-key
1002+
* @template TConcatValue
1003+
*
1004+
* @param iterable<TConcatKey, TConcatValue> $source
1005+
* @return static<TKey|TConcatKey, TValue|TConcatValue>
10031006
*/
10041007
public function concat($source)
10051008
{

src/Illuminate/Collections/Enumerable.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -816,8 +816,11 @@ public function partition($key, $operator = null, $value = null);
816816
/**
817817
* Push all of the given items onto the collection.
818818
*
819-
* @param iterable<array-key, TValue> $source
820-
* @return static
819+
* @template TConcatKey of array-key
820+
* @template TConcatValue
821+
*
822+
* @param iterable<TConcatKey, TConcatValue> $source
823+
* @return static<TKey|TConcatKey, TValue|TConcatValue>
821824
*/
822825
public function concat($source);
823826

src/Illuminate/Collections/LazyCollection.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -991,8 +991,11 @@ public function select($keys)
991991
/**
992992
* Push all of the given items onto the collection.
993993
*
994-
* @param iterable<array-key, TValue> $source
995-
* @return static
994+
* @template TConcatKey of array-key
995+
* @template TConcatValue
996+
*
997+
* @param iterable<TConcatKey, TConcatValue> $source
998+
* @return static<TKey|TConcatKey, TValue|TConcatValue>
996999
*/
9971000
public function concat($source)
9981001
{

tests/Integration/Auth/ApiAuthenticationWithEloquentTest.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Illuminate\Tests\Integration\Auth;
44

55
use Illuminate\Database\QueryException;
6-
use Illuminate\Foundation\Auth\User as FoundationUser;
76
use Illuminate\Support\Facades\Route;
87
use Illuminate\Support\Str;
98
use Orchestra\Testbench\TestCase;
@@ -12,11 +11,10 @@
1211
#[RequiresPhpExtension('pdo_mysql')]
1312
class ApiAuthenticationWithEloquentTest extends TestCase
1413
{
15-
protected function getEnvironmentSetUp($app)
14+
protected function defineEnvironment($app)
1615
{
1716
// Auth configuration
1817
$app['config']->set('auth.defaults.guard', 'api');
19-
$app['config']->set('auth.providers.users.model', User::class);
2018

2119
$app['config']->set('auth.guards.api', [
2220
'driver' => 'token',
@@ -58,8 +56,3 @@ public function testAuthenticationViaApiWithEloquentUsingWrongDatabaseCredential
5856
}
5957
}
6058
}
61-
62-
class User extends FoundationUser
63-
{
64-
//
65-
}

tests/Integration/Auth/AuthenticationTest.php

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,50 @@
1313
use Illuminate\Auth\SessionGuard;
1414
use Illuminate\Database\Schema\Blueprint;
1515
use Illuminate\Events\Dispatcher;
16+
use Illuminate\Foundation\Testing\RefreshDatabase;
1617
use Illuminate\Support\Facades\Auth;
1718
use Illuminate\Support\Facades\Event;
1819
use Illuminate\Support\Facades\Schema;
1920
use Illuminate\Support\Str;
2021
use Illuminate\Support\Testing\Fakes\EventFake;
2122
use Illuminate\Tests\Integration\Auth\Fixtures\AuthenticationTestUser;
2223
use InvalidArgumentException;
24+
use Orchestra\Testbench\Attributes\WithMigration;
2325
use Orchestra\Testbench\TestCase;
2426

27+
#[WithMigration]
2528
class AuthenticationTest extends TestCase
2629
{
27-
protected function getEnvironmentSetUp($app)
30+
use RefreshDatabase;
31+
32+
protected function defineEnvironment($app)
2833
{
29-
$app['config']->set('auth.providers.users.model', AuthenticationTestUser::class);
34+
$app['config']->set([
35+
'auth.providers.users.model' => AuthenticationTestUser::class,
36+
'hashing.driver' => 'bcrypt',
37+
]);
38+
}
3039

31-
$app['config']->set('hashing', ['driver' => 'bcrypt']);
40+
protected function defineRoutes($router)
41+
{
42+
$router->get('basic', function () {
43+
return $this->app['auth']->guard()->basic()
44+
?: $this->app['auth']->user()->toJson();
45+
});
46+
47+
$router->get('basicWithCondition', function () {
48+
return $this->app['auth']->guard()->basic('email', ['is_active' => true])
49+
?: $this->app['auth']->user()->toJson();
50+
});
3251
}
3352

34-
protected function setUp(): void
53+
protected function afterRefreshingDatabase()
3554
{
36-
parent::setUp();
37-
38-
Schema::create('users', function (Blueprint $table) {
39-
$table->increments('id');
40-
$table->string('email');
41-
$table->string('username');
42-
$table->string('password');
43-
$table->string('remember_token')->default(null)->nullable();
55+
Schema::table('users', function (Blueprint $table) {
56+
$table->renameColumn('name', 'username');
57+
});
58+
59+
Schema::table('users', function (Blueprint $table) {
4460
$table->tinyInteger('is_active')->default(0);
4561
});
4662

@@ -50,16 +66,6 @@ protected function setUp(): void
5066
'password' => bcrypt('password'),
5167
'is_active' => true,
5268
]);
53-
54-
$this->app->make('router')->get('basic', function () {
55-
return $this->app['auth']->guard()->basic()
56-
?: $this->app['auth']->user()->toJson();
57-
});
58-
59-
$this->app->make('router')->get('basicWithCondition', function () {
60-
return $this->app['auth']->guard()->basic('email', ['is_active' => true])
61-
?: $this->app['auth']->user()->toJson();
62-
});
6369
}
6470

6571
public function testBasicAuthProtectsRoute()

tests/Integration/Auth/ForgotPasswordTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,21 @@
33
namespace Illuminate\Tests\Integration\Auth;
44

55
use Illuminate\Auth\Notifications\ResetPassword;
6+
use Illuminate\Foundation\Testing\RefreshDatabase;
67
use Illuminate\Notifications\Messages\MailMessage;
78
use Illuminate\Support\Facades\Notification;
89
use Illuminate\Support\Facades\Password;
910
use Illuminate\Support\Str;
1011
use Illuminate\Tests\Integration\Auth\Fixtures\AuthenticationTestUser;
12+
use Orchestra\Testbench\Attributes\WithMigration;
1113
use Orchestra\Testbench\Factories\UserFactory;
1214
use Orchestra\Testbench\TestCase;
1315

16+
#[WithMigration]
1417
class ForgotPasswordTest extends TestCase
1518
{
19+
use RefreshDatabase;
20+
1621
protected function tearDown(): void
1722
{
1823
ResetPassword::$createUrlCallback = null;
@@ -27,11 +32,6 @@ protected function defineEnvironment($app)
2732
$app['config']->set('auth.providers.users.model', AuthenticationTestUser::class);
2833
}
2934

30-
protected function defineDatabaseMigrations()
31-
{
32-
$this->loadLaravelMigrations();
33-
}
34-
3535
protected function defineRoutes($router)
3636
{
3737
$router->get('password/reset/{token}', function ($token) {

tests/Integration/Auth/ForgotPasswordWithoutDefaultRoutesTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,21 @@
33
namespace Illuminate\Tests\Integration\Auth;
44

55
use Illuminate\Auth\Notifications\ResetPassword;
6+
use Illuminate\Foundation\Testing\RefreshDatabase;
67
use Illuminate\Notifications\Messages\MailMessage;
78
use Illuminate\Support\Facades\Notification;
89
use Illuminate\Support\Facades\Password;
910
use Illuminate\Support\Str;
1011
use Illuminate\Tests\Integration\Auth\Fixtures\AuthenticationTestUser;
12+
use Orchestra\Testbench\Attributes\WithMigration;
1113
use Orchestra\Testbench\Factories\UserFactory;
1214
use Orchestra\Testbench\TestCase;
1315

16+
#[WithMigration]
1417
class ForgotPasswordWithoutDefaultRoutesTest extends TestCase
1518
{
19+
use RefreshDatabase;
20+
1621
protected function tearDown(): void
1722
{
1823
ResetPassword::$createUrlCallback = null;
@@ -27,11 +32,6 @@ protected function defineEnvironment($app)
2732
$app['config']->set('auth.providers.users.model', AuthenticationTestUser::class);
2833
}
2934

30-
protected function defineDatabaseMigrations()
31-
{
32-
$this->loadLaravelMigrations();
33-
}
34-
3535
protected function defineRoutes($router)
3636
{
3737
$router->get('custom/password/reset/{token}', function ($token) {

tests/Integration/Cache/DynamoDbStoreTest.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,12 @@
77
use Illuminate\Contracts\Cache\Repository;
88
use Illuminate\Support\Facades\Cache;
99
use Illuminate\Support\Str;
10+
use Orchestra\Testbench\Attributes\RequiresEnv;
1011
use Orchestra\Testbench\TestCase;
1112

13+
#[RequiresEnv('DYNAMODB_CACHE_TABLE')]
1214
class DynamoDbStoreTest extends TestCase
1315
{
14-
protected function setUp(): void
15-
{
16-
if (! env('DYNAMODB_CACHE_TABLE')) {
17-
$this->markTestSkipped('DynamoDB not configured.');
18-
}
19-
20-
parent::setUp();
21-
}
22-
2316
public function testItemsCanBeStoredAndRetrieved()
2417
{
2518
Cache::driver('dynamodb')->put('name', 'Taylor', 10);

tests/Integration/Cache/FileCacheLockTest.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,12 @@
44

55
use Exception;
66
use Illuminate\Support\Facades\Cache;
7+
use Orchestra\Testbench\Attributes\WithConfig;
78
use Orchestra\Testbench\TestCase;
89

10+
#[WithConfig('cache.default', 'file')]
911
class FileCacheLockTest extends TestCase
1012
{
11-
/**
12-
* Define environment setup.
13-
*
14-
* @param \Illuminate\Foundation\Application $app
15-
* @return void
16-
*/
17-
protected function getEnvironmentSetUp($app)
18-
{
19-
$app['config']->set('cache.default', 'file');
20-
}
21-
2213
public function testLocksCanBeAcquiredAndReleased()
2314
{
2415
Cache::lock('foo')->forceRelease();

0 commit comments

Comments
 (0)