language
stringclasses
1 value
owner
stringlengths
2
15
repo
stringlengths
2
21
sha
stringlengths
45
45
message
stringlengths
7
36.3k
path
stringlengths
1
199
patch
stringlengths
15
102k
is_multipart
bool
2 classes
Other
laravel
framework
66bfbd5cbb2ea482312d098aa3b9b1c27ce521e7.json
Apply fixes from StyleCI
src/Illuminate/Container/Container.php
@@ -462,6 +462,7 @@ public function extend($abstract, Closure $closure) * Register an existing instance as shared in the container. * * @template T + * * @param string $abstract * @param T $instance * @return T @@ -685,6 +686,7 @@ public function makeWith($abstract, array $parameters = []) * Resolve the given type from the container. * * @template T + * * @param class-string<T> $abstract * @param array $parameters * @return T|mixed
true
Other
laravel
framework
66bfbd5cbb2ea482312d098aa3b9b1c27ce521e7.json
Apply fixes from StyleCI
src/Illuminate/Contracts/Container/Container.php
@@ -114,6 +114,7 @@ public function extend($abstract, Closure $closure); * Register an existing instance as shared in the container. * * @template T + * * @param string $abstract * @param T $instance * @return T @@ -157,6 +158,7 @@ public function flush(); * Resolve the given type from the container. * * @template T + * * @param class-string<T> $abstract * @param array $parameters * @return T|mixed
true
Other
laravel
framework
66bfbd5cbb2ea482312d098aa3b9b1c27ce521e7.json
Apply fixes from StyleCI
src/Illuminate/Foundation/Application.php
@@ -830,6 +830,7 @@ public function registerDeferredProvider($provider, $service = null) * Resolve the given type from the container. * * @template T + * * @param class-string<T> $abstract * @param array $parameters * @return T|mixed
true
Other
laravel
framework
66bfbd5cbb2ea482312d098aa3b9b1c27ce521e7.json
Apply fixes from StyleCI
src/Illuminate/Foundation/helpers.php
@@ -107,6 +107,7 @@ function action($name, $parameters = [], $absolute = true) * Get the available container instance. * * @template T + * * @param class-string<T>|mixed $abstract * @param array $parameters * @return mixed|T|\Illuminate\Contracts\Foundation\Application
true
Other
laravel
framework
b722497e08ebf55b667b6b17808bc01907f8e62f.json
Use str_replace() instead of Str::replace().
src/Illuminate/Console/Scheduling/ScheduleTestCommand.php
@@ -4,7 +4,6 @@ use Illuminate\Console\Application; use Illuminate\Console\Command; -use Illuminate\Support\Str; class ScheduleTestCommand extends Command { @@ -55,7 +54,7 @@ public function handle(Schedule $schedule) $commandBinary = Application::phpBinary().' '.Application::artisanBinary(); $matches = array_filter($commandNames, function ($commandName) use ($commandBinary, $name) { - return trim(Str::replace($commandBinary, '', $commandName)) === $name; + return trim(str_replace($commandBinary, '', $commandName)) === $name; }); if (count($matches) !== 1) {
false
Other
laravel
framework
6cc602456ff3652a9b6178c4347e7f113965607b.json
use arrow functions for Database (#41532)
src/Illuminate/Database/Connectors/ConnectionFactory.php
@@ -177,7 +177,7 @@ protected function createPdoResolver(array $config) protected function createPdoResolverWithHosts(array $config) { return function () use ($config) { - foreach (Arr::shuffle($hosts = $this->parseHosts($config)) as $key => $host) { + foreach (Arr::shuffle($this->parseHosts($config)) as $host) { $config['host'] = $host; try { @@ -218,9 +218,7 @@ protected function parseHosts(array $config) */ protected function createPdoResolverWithoutHosts(array $config) { - return function () use ($config) { - return $this->createConnector($config)->connect($config); - }; + return fn () => $this->createConnector($config)->connect($config); } /**
true
Other
laravel
framework
6cc602456ff3652a9b6178c4347e7f113965607b.json
use arrow functions for Database (#41532)
src/Illuminate/Database/DatabaseTransactionsManager.php
@@ -44,10 +44,9 @@ public function begin($connection, $level) */ public function rollback($connection, $level) { - $this->transactions = $this->transactions->reject(function ($transaction) use ($connection, $level) { - return $transaction->connection == $connection && - $transaction->level > $level; - })->values(); + $this->transactions = $this->transactions->reject( + fn ($transaction) => $transaction->connection == $connection && $transaction->level > $level + )->values(); } /** @@ -59,9 +58,7 @@ public function rollback($connection, $level) public function commit($connection) { [$forThisConnection, $forOtherConnections] = $this->transactions->partition( - function ($transaction) use ($connection) { - return $transaction->connection == $connection; - } + fn ($transaction) => $transaction->connection == $connection ); $this->transactions = $forOtherConnections->values();
true
Other
laravel
framework
91e517370e1700629f7f2be252da0f0fe62cce0e.json
Fix Style CI.
src/Illuminate/Console/Scheduling/ScheduleTestCommand.php
@@ -55,7 +55,7 @@ public function handle(Schedule $schedule) $commandBinary = Application::phpBinary().' '.Application::artisanBinary(); $matches = array_filter($commandNames, function ($commandName) use ($commandBinary, $name) { - return trim(Str::replace($commandBinary, '', $commandName)) === $name; + return trim(Str::replace($commandBinary, '', $commandName)) === $name; }); if (count($matches) !== 1) {
false
Other
laravel
framework
650ca875d3bd7e876ed89f803c705d5d6c121d90.json
Add tests for ucsplit in stringable (#41499)
tests/Support/SupportStringableTest.php
@@ -150,6 +150,13 @@ public function testWhenContainsAll() })); } + public function testUcsplitOnStringable() + { + $this->assertSame(['Taylor', 'Otwell'], $this->stringable('TaylorOtwell')->ucsplit()->toArray()); + $this->assertSame(['Hello', 'From', 'Laravel'], $this->stringable('HelloFromLaravel')->ucsplit()->toArray()); + $this->assertSame(['He_llo_', 'World'], $this->stringable('He_llo_World')->ucsplit()->toArray()); + } + public function testWhenEndsWith() { $this->assertSame('Tony Stark', (string) $this->stringable('tony stark')->whenEndsWith('ark', function ($stringable) {
false
Other
laravel
framework
d39d92df9b3c509d40b971207f03eb7f04087370.json
fix deprecation warning
src/Illuminate/Collections/Arr.php
@@ -169,6 +169,10 @@ public static function exists($array, $key) return $array->offsetExists($key); } + if (is_float($key)) { + $key = (string) $key; + } + return array_key_exists($key, $array); }
false
Other
laravel
framework
2d53f70fa20df3b72d996304db2d631fd2fefa6a.json
fix a typo (#41498)
CHANGELOG.md
@@ -19,7 +19,7 @@ - Added callable support to operatorForWhere on Collection ([#41414](https://github.com/laravel/framework/pull/41414), [#41424](https://github.com/laravel/framework/pull/41424)) - Added partial queue faking ([#41425](https://github.com/laravel/framework/pull/41425)) - Added --name option to schedule:test command ([#41439](https://github.com/laravel/framework/pull/41439)) -- Define `Illuminate/Database/Eloquent/Concerns/HasRelationships::newThroughInstance()` ([#41444](https://github.com/laravel/framework/pull/41444)) +- Define `Illuminate/Database/Eloquent/Concerns/HasRelationships::newRelatedThroughInstance()` ([#41444](https://github.com/laravel/framework/pull/41444)) - Added `Illuminate/Support/Stringable::wrap()` ([#41455](https://github.com/laravel/framework/pull/41455)) - Adds "freezeTime" helper for tests ([#41460](https://github.com/laravel/framework/pull/41460)) - Allow for callables with beforeSending in`Illuminate/Http/Client/PendingRequest.php::runBeforeSendingCallbacks()` ([#41489](https://github.com/laravel/framework/pull/41489))
false
Other
laravel
framework
31e6062c552993cca958d9b71901bf6e05a2bc1e.json
fix method doctypes of Arr Support class (#41488)
src/Illuminate/Collections/Arr.php
@@ -25,7 +25,7 @@ public static function accessible($value) * Add an element to an array using "dot" notation if it doesn't exist. * * @param array $array - * @param string $key + * @param string|int|float $key * @param mixed $value * @return array */ @@ -599,7 +599,7 @@ public static function random($array, $number = null, $preserveKeys = false) * If no key is given to the method, the entire array will be replaced. * * @param array $array - * @param string|null $key + * @param string|int|null $key * @param mixed $value * @return array */
true
Other
laravel
framework
31e6062c552993cca958d9b71901bf6e05a2bc1e.json
fix method doctypes of Arr Support class (#41488)
tests/Support/SupportArrTest.php
@@ -32,6 +32,8 @@ public function testAdd() $this->assertEquals(['surname' => 'Mövsümov'], Arr::add([], 'surname', 'Mövsümov')); $this->assertEquals(['developer' => ['name' => 'Ferid']], Arr::add([], 'developer.name', 'Ferid')); + $this->assertEquals([1 => 'hAz'], Arr::add([], 1, 'hAz')); + $this->assertEquals([1 => [1 => 'hAz']], Arr::add([], 1.1, 'hAz')); } public function testCollapse() @@ -760,6 +762,9 @@ public function testSet() $array = ['products' => 'table']; Arr::set($array, 'products.desk.price', 300); $this->assertSame(['products' => ['desk' => ['price' => 300]]], $array); + + $array = [1 => 'test']; + $this->assertEquals([1 => 'hAz'], Arr::set($array, 1, 'hAz')); } public function testShuffleWithSeed()
true
Other
laravel
framework
a075753ad0385d755140b8c748e17cc3f95a8914.json
fix return type (#41457)
src/Illuminate/Routing/Route.php
@@ -1100,7 +1100,7 @@ public function excludedMiddleware() /** * Indicate that the route should enforce scoping of multiple implicit Eloquent bindings. * - * @return bool + * @return $this */ public function scopeBindings() {
false
Other
laravel
framework
a7b21b84732e8d1139003d30f72a5cc20a2f726d.json
Update AuthenticateSession.php (#41447)
src/Illuminate/Session/Middleware/AuthenticateSession.php
@@ -48,11 +48,11 @@ public function handle($request, Closure $next) } } - if (! $request->session()->has('password_hash_'.$this->auth->getDefaultDriver())) { + if (! $request->session()->has('password_hash_'.$this->guard()->getDefaultDriver())) { $this->storePasswordHashInSession($request); } - if ($request->session()->get('password_hash_'.$this->auth->getDefaultDriver()) !== $request->user()->getAuthPassword()) { + if ($request->session()->get('password_hash_'.$this->guard()->getDefaultDriver()) !== $request->user()->getAuthPassword()) { $this->logout($request); } @@ -76,7 +76,7 @@ protected function storePasswordHashInSession($request) } $request->session()->put([ - 'password_hash_'.$this->auth->getDefaultDriver() => $request->user()->getAuthPassword(), + 'password_hash_'.$this->guard()->getDefaultDriver() => $request->user()->getAuthPassword(), ]); } @@ -94,7 +94,7 @@ protected function logout($request) $request->session()->flush(); - throw new AuthenticationException('Unauthenticated.', [$this->auth->getDefaultDriver()]); + throw new AuthenticationException('Unauthenticated.', [$this->guard()->getDefaultDriver()]); } /**
false
Other
laravel
framework
b71144ac57865b7e4a53fb23c7a901fc28362cbe.json
Update RouteListCommand.php (#41448)
src/Illuminate/Foundation/Console/RouteListCommand.php
@@ -452,7 +452,7 @@ protected function getOptions() ['path', null, InputOption::VALUE_OPTIONAL, 'Only show routes matching the given path pattern'], ['except-path', null, InputOption::VALUE_OPTIONAL, 'Do not display the routes matching the given path pattern'], ['reverse', 'r', InputOption::VALUE_NONE, 'Reverse the ordering of the routes'], - ['sort', null, InputOption::VALUE_OPTIONAL, 'The column (precedence, domain, method, uri, name, action, middleware) to sort by', 'uri'], + ['sort', null, InputOption::VALUE_OPTIONAL, 'The column (domain, method, uri, name, action, middleware) to sort by', 'uri'], ['except-vendor', null, InputOption::VALUE_NONE, 'Do not display routes defined by vendor packages'], ]; }
false
Other
laravel
framework
56831cb58b4da2801be55fca4ccc9a4c561eac82.json
define a new method to create a through model
src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php
@@ -115,7 +115,7 @@ protected function newHasOne(Builder $query, Model $parent, $foreignKey, $localK */ public function hasOneThrough($related, $through, $firstKey = null, $secondKey = null, $localKey = null, $secondLocalKey = null) { - $through = new $through; + $through = $this->newThroughInstance($through); $firstKey = $firstKey ?: $this->getForeignKey(); @@ -387,7 +387,7 @@ protected function newHasMany(Builder $query, Model $parent, $foreignKey, $local */ public function hasManyThrough($related, $through, $firstKey = null, $secondKey = null, $localKey = null, $secondLocalKey = null) { - $through = new $through; + $through = $this->newThroughInstance($through); $firstKey = $firstKey ?: $this->getForeignKey(); @@ -759,6 +759,17 @@ protected function newRelatedInstance($class) }); } + /** + * Create a new model instance for a through model. + * + * @param string $class + * @return mixed + */ + protected function newThroughInstance($class) + { + return new $class; + } + /** * Get all the loaded relations for the instance. *
false
Other
laravel
framework
6a05d150eb828c852960517f9d15d99ea42f0f41.json
Update reserved names in GeneratorCommand (#41441) Since PHP 8.0 there are new keywords, which should be reserved in GeneratorCommand class.
src/Illuminate/Console/GeneratorCommand.php
@@ -56,6 +56,7 @@ abstract class GeneratorCommand extends Command 'endif', 'endswitch', 'endwhile', + 'enum', 'eval', 'exit', 'extends', @@ -76,13 +77,15 @@ abstract class GeneratorCommand extends Command 'interface', 'isset', 'list', + 'match', 'namespace', 'new', 'or', 'print', 'private', 'protected', 'public', + 'readonly', 'require', 'require_once', 'return',
false
Other
laravel
framework
5319ddba567b3ccd94a21371a7ec760e4059e8a2.json
add string to docblocks
src/Illuminate/Collections/Enumerable.php
@@ -757,7 +757,7 @@ public function nth($step, $offset = 0); /** * Get the items with the specified keys. * - * @param \Illuminate\Support\Enumerable<array-key, TKey>|array<array-key, TKey> $keys + * @param \Illuminate\Support\Enumerable<array-key, TKey>|array<array-key, TKey>|string $keys * @return static */ public function only($keys);
true
Other
laravel
framework
5319ddba567b3ccd94a21371a7ec760e4059e8a2.json
add string to docblocks
src/Illuminate/Collections/LazyCollection.php
@@ -861,7 +861,7 @@ public function nth($step, $offset = 0) /** * Get the items with the specified keys. * - * @param \Illuminate\Support\Enumerable<array-key, TKey>|array<array-key, TKey> $keys + * @param \Illuminate\Support\Enumerable<array-key, TKey>|array<array-key, TKey>|string $keys * @return static */ public function only($keys)
true
Other
laravel
framework
352a6f173071d0ce8cb5659563a56dfca3891bfc.json
Update Collection.php (#41438)
src/Illuminate/Collections/Collection.php
@@ -856,7 +856,7 @@ public function nth($step, $offset = 0) /** * Get the items with the specified keys. * - * @param \Illuminate\Support\Enumerable<array-key, TKey>|array<array-key, TKey> $keys + * @param \Illuminate\Support\Enumerable<array-key, TKey>|array<array-key, TKey>|string $keys * @return static */ public function only($keys)
false
Other
laravel
framework
9684a047dd9d29654a200d194a0f34ea390bb987.json
Add partial queue faking (#41425) * add partial queue faking * Apply fixes from StyleCI Co-authored-by: StyleCI Bot <bot@styleci.io>
src/Illuminate/Support/Facades/Queue.php
@@ -42,11 +42,12 @@ public static function popUsing($workerName, $callback) /** * Replace the bound instance with a fake. * + * @param array|string $jobsToFake * @return \Illuminate\Support\Testing\Fakes\QueueFake */ - public static function fake() + public static function fake($jobsToFake = []) { - static::swap($fake = new QueueFake(static::getFacadeApplication())); + static::swap($fake = new QueueFake(static::getFacadeApplication(), $jobsToFake, static::getFacadeRoot())); return $fake; }
true
Other
laravel
framework
9684a047dd9d29654a200d194a0f34ea390bb987.json
Add partial queue faking (#41425) * add partial queue faking * Apply fixes from StyleCI Co-authored-by: StyleCI Bot <bot@styleci.io>
src/Illuminate/Support/Testing/Fakes/QueueFake.php
@@ -6,20 +6,51 @@ use Closure; use Illuminate\Contracts\Queue\Queue; use Illuminate\Queue\QueueManager; +use Illuminate\Support\Collection; use Illuminate\Support\Traits\ReflectsClosures; use PHPUnit\Framework\Assert as PHPUnit; class QueueFake extends QueueManager implements Queue { use ReflectsClosures; + /** + * The original queue manager. + * + * @var \Illuminate\Contracts\Queue\Queue + */ + protected $queue; + + /** + * The job types that should be intercepted instead of pushed to the queue. + * + * @var array + */ + protected $jobsToFake; + /** * All of the jobs that have been pushed. * * @var array */ protected $jobs = []; + /** + * Create a new fake queue instance. + * + * @param \Illuminate\Contracts\Foundation\Application $app + * @param array $jobsToFake + * @param \Illuminate\Queue\QueueManager|null $queue + * @return void + */ + public function __construct($app, $jobsToFake = [], $queue = null) + { + parent::__construct($app); + + $this->jobsToFake = Collection::wrap($jobsToFake); + $this->queue = $queue; + } + /** * Assert if a job was pushed based on a truth-test callback. * @@ -279,10 +310,33 @@ public function size($queue = null) */ public function push($job, $data = '', $queue = null) { - $this->jobs[is_object($job) ? get_class($job) : $job][] = [ - 'job' => $job, - 'queue' => $queue, - ]; + if ($this->shouldFakeJob($job)) { + $this->jobs[is_object($job) ? get_class($job) : $job][] = [ + 'job' => $job, + 'queue' => $queue, + ]; + } else { + is_object($job) && isset($job->connection) + ? $this->queue->connection($job->connection)->push($job, $data, $queue) + : $this->queue->push($job, $data, $queue); + } + } + + /** + * Determine if a job should be faked or actually dispatched. + * + * @param object $job + * @return bool + */ + public function shouldFakeJob($job) + { + if ($this->jobsToFake->isEmpty()) { + return true; + } + + return $this->jobsToFake->contains(function ($jobToFake) use ($job) { + return $job instanceof ((string) $jobToFake); + }); } /**
true
Other
laravel
framework
9684a047dd9d29654a200d194a0f34ea390bb987.json
Add partial queue faking (#41425) * add partial queue faking * Apply fixes from StyleCI Co-authored-by: StyleCI Bot <bot@styleci.io>
tests/Support/SupportTestingQueueFakeTest.php
@@ -5,7 +5,9 @@ use BadMethodCallException; use Illuminate\Bus\Queueable; use Illuminate\Foundation\Application; +use Illuminate\Queue\QueueManager; use Illuminate\Support\Testing\Fakes\QueueFake; +use Mockery as m; use PHPUnit\Framework\Constraint\ExceptionMessage; use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\TestCase; @@ -29,6 +31,13 @@ protected function setUp(): void $this->job = new JobStub; } + protected function tearDown(): void + { + parent::tearDown(); + + m::close(); + } + public function testAssertPushed() { try { @@ -43,6 +52,24 @@ public function testAssertPushed() $this->fake->assertPushed(JobStub::class); } + public function testAssertPushedWithIgnore() + { + $job = new JobStub; + + $manager = m::mock(QueueManager::class); + $manager->shouldReceive('push')->once()->withArgs(function ($passedJob) use ($job) { + return $passedJob === $job; + }); + + $fake = new QueueFake(new Application, JobToFakeStub::class, $manager); + + $fake->push($job); + $fake->push(new JobToFakeStub()); + + $fake->assertNotPushed(JobStub::class); + $fake->assertPushed(JobToFakeStub::class); + } + public function testAssertPushedWithClosure() { $this->fake->push($this->job); @@ -297,6 +324,14 @@ public function handle() } } +class JobToFakeStub +{ + public function handle() + { + // + } +} + class JobWithChainStub { use Queueable;
true
Other
laravel
framework
bf9f8f702f8f8847d95e7a6c79771ccf93370344.json
fix doc block
src/Illuminate/Filesystem/FilesystemAdapter.php
@@ -149,7 +149,7 @@ public function assertMissing($path) } /** - * Determine if a directory is empty. + * Assert that the given directory is empty. * * @param string $path * @return $this
false
Other
laravel
framework
e98ceae1f49029ec5e9be1e9a98c1546ae2b8f8d.json
Add empty directory assertion (#41398)
src/Illuminate/Filesystem/FilesystemAdapter.php
@@ -148,6 +148,21 @@ public function assertMissing($path) return $this; } + /** + * Determine if a directory is empty. + * + * @param string $path + * @return $this + */ + public function assertDirectoryEmpty($path) + { + PHPUnit::assertEmpty( + $this->allFiles($path), "Directory [{$path}] is not empty." + ); + + return $this; + } + /** * Determine if a file or directory exists. *
false
Other
laravel
framework
b7625b3f699a8b116b2bebbb917cab0f9f5127cf.json
Allow nested markdown files for mailables (#41366)
src/Illuminate/Foundation/Console/MailMakeCommand.php
@@ -102,7 +102,11 @@ protected function getView() $view = $this->option('markdown'); if (! $view) { - $view = 'mail.'.Str::kebab(class_basename($this->argument('name'))); + $name = str_replace('\\', '/', $this->argument('name')); + + $view = 'mail.'.collect(explode('/', $name)) + ->map(fn ($part) => Str::kebab($part)) + ->implode('.'); } return $view;
false
Other
laravel
framework
aac0da02132d38cff8fe9ff6aee5f9b0ca689a18.json
Fix LazyCollection#takeUntilTimeout (#41370)
src/Illuminate/Collections/LazyCollection.php
@@ -1414,18 +1414,16 @@ public function takeUntilTimeout(DateTimeInterface $timeout) $timeout = $timeout->getTimestamp(); return new static(function () use ($timeout) { - $iterator = $this->getIterator(); - - if (! $iterator->valid() || $this->now() > $timeout) { + if ($this->now() >= $timeout) { return; } - yield $iterator->key() => $iterator->current(); - - while ($iterator->valid() && $this->now() < $timeout) { - $iterator->next(); + foreach ($this as $key => $value) { + yield $key => $value; - yield $iterator->key() => $iterator->current(); + if ($this->now() >= $timeout) { + break; + } } }); }
true
Other
laravel
framework
aac0da02132d38cff8fe9ff6aee5f9b0ca689a18.json
Fix LazyCollection#takeUntilTimeout (#41370)
tests/Support/SupportLazyCollectionIsLazyTest.php
@@ -3,9 +3,11 @@ namespace Illuminate\Tests\Support; use Exception; +use Illuminate\Support\Carbon; use Illuminate\Support\ItemNotFoundException; use Illuminate\Support\LazyCollection; use Illuminate\Support\MultipleItemsFoundException; +use Mockery as m; use PHPUnit\Framework\TestCase; use stdClass; @@ -1214,6 +1216,72 @@ public function testTakeUntilIsLazy() }); } + public function testTakeUntilTimeoutIsLazy() + { + tap(m::mock(LazyCollection::class.'[now]')->times(100), function ($mock) { + $this->assertDoesNotEnumerateCollection($mock, function ($mock) { + $timeout = Carbon::now(); + + $results = $mock + ->tap(function ($collection) use ($mock, $timeout) { + tap($collection) + ->mockery_init($mock->mockery_getContainer()) + ->shouldAllowMockingProtectedMethods() + ->shouldReceive('now') + ->times(1) + ->andReturn( + $timeout->getTimestamp() + ); + }) + ->takeUntilTimeout($timeout) + ->all(); + }); + }); + + tap(m::mock(LazyCollection::class.'[now]')->times(100), function ($mock) { + $this->assertEnumeratesCollection($mock, 1, function ($mock) { + $timeout = Carbon::now(); + + $results = $mock + ->tap(function ($collection) use ($mock, $timeout) { + tap($collection) + ->mockery_init($mock->mockery_getContainer()) + ->shouldAllowMockingProtectedMethods() + ->shouldReceive('now') + ->times(2) + ->andReturn( + (clone $timeout)->sub(1, 'minute')->getTimestamp(), + $timeout->getTimestamp() + ); + }) + ->takeUntilTimeout($timeout) + ->all(); + }); + }); + + tap(m::mock(LazyCollection::class.'[now]')->times(100), function ($mock) { + $this->assertEnumeratesCollectionOnce($mock, function ($mock) { + $timeout = Carbon::now(); + + $results = $mock + ->tap(function ($collection) use ($mock, $timeout) { + tap($collection) + ->mockery_init($mock->mockery_getContainer()) + ->shouldAllowMockingProtectedMethods() + ->shouldReceive('now') + ->times(100) + ->andReturn( + (clone $timeout)->sub(1, 'minute')->getTimestamp() + ); + }) + ->takeUntilTimeout($timeout) + ->all(); + }); + }); + + m::close(); + } + public function testTakeWhileIsLazy() { $this->assertDoesNotEnumerate(function ($collection) {
true
Other
laravel
framework
aac0da02132d38cff8fe9ff6aee5f9b0ca689a18.json
Fix LazyCollection#takeUntilTimeout (#41370)
tests/Support/SupportLazyCollectionTest.php
@@ -196,32 +196,6 @@ public function testTakeUntilTimeout() m::close(); } - public function testTakeUntilTimeoutWithPastTimeout() - { - $timeout = Carbon::now()->subMinute(); - - $mock = m::mock(LazyCollection::class.'[now]'); - - $results = $mock - ->times(10) - ->tap(function ($collection) use ($mock, $timeout) { - tap($collection) - ->mockery_init($mock->mockery_getContainer()) - ->shouldAllowMockingProtectedMethods() - ->shouldReceive('now') - ->times(1) - ->andReturn( - (clone $timeout)->add(1, 'minute')->getTimestamp(), - ); - }) - ->takeUntilTimeout($timeout) - ->all(); - - $this->assertSame([], $results); - - m::close(); - } - public function testTapEach() { $data = LazyCollection::times(10);
true
Other
laravel
framework
1846fb3e88818cfd3ec78150666a51295feddf7d.json
Add soleValue method to query builders
src/Illuminate/Database/Eloquent/Builder.php
@@ -614,6 +614,20 @@ public function value($column) } } + /** + * Get a single column's value from the first result of a query if it's the sole matching record. + * + * @param string|\Illuminate\Database\Query\Expression $column + * @return mixed + * + * @throws \Illuminate\Database\Eloquent\ModelNotFoundException<\Illuminate\Database\Eloquent\Model> + * @throws \Illuminate\Database\MultipleRecordsFoundException + */ + public function soleValue($column) + { + return $this->sole([$column])->{Str::afterLast($column, '.')}; + } + /** * Get a single column's value from the first result of the query or throw an exception. *
true
Other
laravel
framework
1846fb3e88818cfd3ec78150666a51295feddf7d.json
Add soleValue method to query builders
src/Illuminate/Database/Query/Builder.php
@@ -2516,6 +2516,22 @@ public function value($column) return count($result) > 0 ? reset($result) : null; } + /** + * Get a single column's value from the first result of a query if it's the sole matching record. + * + * @param string $column + * @return mixed + * + * @throws \Illuminate\Database\RecordsNotFoundException + * @throws \Illuminate\Database\MultipleRecordsFoundException + */ + public function soleValue($column) + { + $result = (array) $this->sole([$column]); + + return reset($result); + } + /** * Execute the query as a "select" statement. *
true
Other
laravel
framework
8ce9c834f9f9124af425c27795853efaa2c6aaad.json
Fix typehint template
src/Illuminate/Collections/Collection.php
@@ -231,7 +231,7 @@ public function diff($items) * Get the items in the collection that are not present in the given items, using the callback. * * @param \Illuminate\Contracts\Support\Arrayable<array-key, TValue>|iterable<array-key, TValue> $items - * @param callable(TValue): int $callback + * @param callable(TValue, TValue): int $callback * @return static */ public function diffUsing($items, callable $callback) @@ -254,7 +254,7 @@ public function diffAssoc($items) * Get the items in the collection whose keys and values are not present in the given items, using the callback. * * @param \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue> $items - * @param callable(TKey): int $callback + * @param callable(TKey, TKey): int $callback * @return static */ public function diffAssocUsing($items, callable $callback) @@ -277,7 +277,7 @@ public function diffKeys($items) * Get the items in the collection whose keys are not present in the given items, using the callback. * * @param \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue> $items - * @param callable(TKey): int $callback + * @param callable(TKey, TKey): int $callback * @return static */ public function diffKeysUsing($items, callable $callback) @@ -1436,7 +1436,7 @@ public function sortKeysDesc($options = SORT_REGULAR) /** * Sort the collection keys using a callback. * - * @param callable $callback + * @param callable(TKey, TKey): int $callback * @return static */ public function sortKeysUsing(callable $callback)
true
Other
laravel
framework
8ce9c834f9f9124af425c27795853efaa2c6aaad.json
Fix typehint template
src/Illuminate/Collections/Enumerable.php
@@ -200,7 +200,7 @@ public function diff($items); * Get the items that are not present in the given items, using the callback. * * @param \Illuminate\Contracts\Support\Arrayable<array-key, TValue>|iterable<array-key, TValue> $items - * @param callable(TValue): int $callback + * @param callable(TValue, TValue): int $callback * @return static */ public function diffUsing($items, callable $callback); @@ -217,7 +217,7 @@ public function diffAssoc($items); * Get the items whose keys and values are not present in the given items, using the callback. * * @param \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue> $items - * @param callable(TKey): int $callback + * @param callable(TKey, TKey): int $callback * @return static */ public function diffAssocUsing($items, callable $callback); @@ -234,7 +234,7 @@ public function diffKeys($items); * Get the items whose keys are not present in the given items, using the callback. * * @param \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue> $items - * @param callable(TKey): int $callback + * @param callable(TKey, TKey): int $callback * @return static */ public function diffKeysUsing($items, callable $callback); @@ -1016,7 +1016,7 @@ public function sortKeysDesc($options = SORT_REGULAR); /** * Sort the collection keys using a callback. * - * @param callable $callback + * @param callable(TKey, TKey): int $callback * @return static */ public function sortKeysUsing(callable $callback);
true
Other
laravel
framework
8ce9c834f9f9124af425c27795853efaa2c6aaad.json
Fix typehint template
src/Illuminate/Collections/LazyCollection.php
@@ -307,7 +307,7 @@ public function diff($items) * Get the items that are not present in the given items, using the callback. * * @param \Illuminate\Contracts\Support\Arrayable<array-key, TValue>|iterable<array-key, TValue> $items - * @param callable(TValue): int $callback + * @param callable(TValue, TValue): int $callback * @return static */ public function diffUsing($items, callable $callback) @@ -330,7 +330,7 @@ public function diffAssoc($items) * Get the items whose keys and values are not present in the given items, using the callback. * * @param \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue> $items - * @param callable(TKey): int $callback + * @param callable(TKey, TKey): int $callback * @return static */ public function diffAssocUsing($items, callable $callback) @@ -353,7 +353,7 @@ public function diffKeys($items) * Get the items whose keys are not present in the given items, using the callback. * * @param \Illuminate\Contracts\Support\Arrayable<TKey, TValue>|iterable<TKey, TValue> $items - * @param callable(TKey): int $callback + * @param callable(TKey, TKey): int $callback * @return static */ public function diffKeysUsing($items, callable $callback) @@ -1344,7 +1344,7 @@ public function sortKeysDesc($options = SORT_REGULAR) /** * Sort the collection keys using a callback. * - * @param callable $callback + * @param callable(TKey, TKey): int $callback * @return static */ public function sortKeysUsing(callable $callback)
true
Other
laravel
framework
0dc884a15a82c209c6a90c29a195c3b2f61d3521.json
remove constructor (#41325) I don't believe there's really any reason a constructor would be used in 99% of console commands. Any dependencies can be injected directly into the `handle()` method.
src/Illuminate/Foundation/Console/stubs/console.stub
@@ -20,16 +20,6 @@ class {{ class }} extends Command */ protected $description = 'Command description'; - /** - * Create a new command instance. - * - * @return void - */ - public function __construct() - { - parent::__construct(); - } - /** * Execute the console command. *
false
Other
laravel
framework
03b673db7f3505d81ce737b2019133a250317bc8.json
Apply fixes from StyleCI
src/Illuminate/Console/Concerns/InteractsWithIO.php
@@ -377,7 +377,7 @@ public function alert($string) public function newLine($count = 1) { $this->output->newLine($count); - + return $this; }
false
Other
laravel
framework
5c77dac3ec8d397f73bb6dcd2d4b1bae010e9592.json
allow chaining of `->newLine()` (#41327) ```php $this->newLine(); $this->info('Success!'); ``` can now be shortened to ```php $this->newLine()->info('Success'); ```
src/Illuminate/Console/Concerns/InteractsWithIO.php
@@ -372,11 +372,13 @@ public function alert($string) * Write a blank line. * * @param int $count - * @return void + * @return $this */ public function newLine($count = 1) { $this->output->newLine($count); + + return $this; } /**
false
Other
laravel
framework
ecec6ca33280f3d9e93e294824cf5bd04424c255.json
remove `static` return types (#41276) these methods only return the Builder
src/Illuminate/Database/Eloquent/SoftDeletes.php
@@ -3,9 +3,9 @@ namespace Illuminate\Database\Eloquent; /** - * @method static static|\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder withTrashed(bool $withTrashed = true) - * @method static static|\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder onlyTrashed() - * @method static static|\Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder withoutTrashed() + * @method static \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder withTrashed(bool $withTrashed = true) + * @method static \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder onlyTrashed() + * @method static \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder withoutTrashed() */ trait SoftDeletes {
false
Other
laravel
framework
356b1221321be41f0721b29d03a35e1535929643.json
Use FQCN in docblocks
src/Illuminate/Conditionable/Traits/Conditionable.php
@@ -13,7 +13,7 @@ trait Conditionable * @template TWhenParameter * @template TWhenReturnType * - * @param (Closure($this): TWhenParameter)|TWhenParameter $value + * @param (\Closure($this): TWhenParameter)|TWhenParameter $value * @param (callable($this, TWhenParameter): TWhenReturnType)|null $callback * @param (callable($this, TWhenParameter): TWhenReturnType)|null $default * @return $this|TWhenReturnType @@ -41,7 +41,7 @@ public function when($value, callable $callback = null, callable $default = null * @template TUnlessParameter * @template TUnlessReturnType * - * @param (Closure($this): TUnlessParameter)|TUnlessParameter $value + * @param (\Closure($this): TUnlessParameter)|TUnlessParameter $value * @param (callable($this, TUnlessParameter): TUnlessReturnType)|null $callback * @param (callable($this, TUnlessParameter): TUnlessReturnType)|null $default * @return $this|TUnlessReturnType
false
Other
laravel
framework
aee3fc2bffe935ce238e0a733cbde098e931b24b.json
Fix typos in type hints (#41238)
src/Illuminate/Collections/Enumerable.php
@@ -1074,7 +1074,7 @@ public function pipe(callable $callback); /** * Pass the collection into a new class. * - * @param string-class $class + * @param class-string $class * @return mixed */ public function pipeInto($class);
true
Other
laravel
framework
aee3fc2bffe935ce238e0a733cbde098e931b24b.json
Fix typos in type hints (#41238)
src/Illuminate/Collections/Traits/EnumeratesValues.php
@@ -715,7 +715,7 @@ public function pipe(callable $callback) /** * Pass the collection into a new class. * - * @param string-class $class + * @param class-string $class * @return mixed */ public function pipeInto($class)
true
Other
laravel
framework
3f2162a8ca7ca29e48a6457568e4459a33f08974.json
Apply fixes from StyleCI
tests/Validation/ValidationValidatorTest.php
@@ -611,8 +611,8 @@ public function testIndexValuesAreReplaced() 'foo', 1, ], - ] - ] + ], + ], ], ['input.*.attributes.*' => 'string'], ['input.*.attributes.*.string' => 'Attribute (:first-index, :first-position) (:second-index, :second-position) must be a string.']); $this->assertFalse($v->passes()); $this->assertSame('Attribute (0, 1) (1, 2) must be a string.', $v->messages()->first('input.*.attributes.*'));
false
Other
laravel
framework
972e4928a9eec8be4f45bc9257ac8ebe1e2c5400.json
Apply fixes from StyleCI
src/Illuminate/Database/DatabaseManager.php
@@ -404,7 +404,7 @@ public function extend($name, callable $resolver) */ public function forgetExtension($name) { - unset($this->extensions[$name]); + unset($this->extensions[$name]); } /**
false
Other
laravel
framework
9820e484d0d01bd9f0d4a194e1a614c8ead5541f.json
Remove useless imports. (#41220)
src/Illuminate/Translation/Translator.php
@@ -2,7 +2,6 @@ namespace Illuminate\Translation; -use Countable; use Illuminate\Contracts\Translation\Loader; use Illuminate\Contracts\Translation\Translator as TranslatorContract; use Illuminate\Support\Arr;
false
Other
laravel
framework
3ed70e93460c903b1a860d0d0572f2dcfdbfeb43.json
Pass listener arguments to middleware method
src/Illuminate/Events/Dispatcher.php
@@ -612,7 +612,7 @@ protected function createListenerAndJob($class, $method, $arguments) * Propagate listener options to the job. * * @param mixed $listener - * @param mixed $job + * @param \Illuminate\Events\CallQueuedListener $job * @return mixed */ protected function propagateListenerOptions($listener, $job) @@ -627,7 +627,7 @@ protected function propagateListenerOptions($listener, $job) $job->tries = $listener->tries ?? null; $job->through(array_merge( - method_exists($listener, 'middleware') ? $listener->middleware() : [], + method_exists($listener, 'middleware') ? $listener->middleware(...$job->data) : [], $listener->middleware ?? [] )); });
true
Other
laravel
framework
3ed70e93460c903b1a860d0d0572f2dcfdbfeb43.json
Pass listener arguments to middleware method
tests/Events/QueuedEventsTest.php
@@ -116,7 +116,10 @@ public function testQueuePropagateMiddleware() $d->dispatch('some.event', ['foo', 'bar']); $fakeQueue->assertPushed(CallQueuedListener::class, function ($job) { - return count($job->middleware) === 1 && $job->middleware[0] instanceof TestMiddleware; + return count($job->middleware) === 1 + && $job->middleware[0] instanceof TestMiddleware + && $job->middleware[0]->a === 'foo' + && $job->middleware[0]->b === 'bar'; }); } } @@ -190,19 +193,28 @@ public function handle() class TestDispatcherMiddleware implements ShouldQueue { - public function middleware() + public function middleware($a, $b) { - return [new TestMiddleware()]; + return [new TestMiddleware($a, $b)]; } - public function handle() + public function handle($a, $b) { // } } class TestMiddleware { + public $a; + public $b; + + public function __construct($a, $b) + { + $this->a = $a; + $this->b = $b; + } + public function handle($job, $next) { $next($job);
true
Other
laravel
framework
dabef8ae8bf74e0720301beabb46236d4c2d1b86.json
Fix typos (#41191)
CHANGELOG.md
@@ -6,16 +6,16 @@ ## [v9.2.0 (2022-02-22)](https://github.com/laravel/framework/compare/v9.1.0...v9.2.0) ### Added -- Added `Illuminate/Database/Eloquent/Casts/Attribute::make()` ([#41014](https://github.com/laravel/framework/pull/41014)) -- Added `Illuminate/Collections/Arr::keyBy()` ([#41029](https://github.com/laravel/framework/pull/41029)) +- Added `Illuminate\Database\Eloquent\Casts\Attribute::make()` ([#41014](https://github.com/laravel/framework/pull/41014)) +- Added `Illuminate\Collections\Arr::keyBy()` ([#41029](https://github.com/laravel/framework/pull/41029)) - Added expectsOutputToContain to the PendingCommand. ([#40984](https://github.com/laravel/framework/pull/40984)) - Added ability to supply HTTP client methods with JsonSerializable instances ([#41055](https://github.com/laravel/framework/pull/41055)) -- Added `Illuminate/Filesystem/AwsS3V3Adapter::getClient()` ([#41079](https://github.com/laravel/framework/pull/41079)) +- Added `Illuminate\Filesystem\AwsS3V3Adapter::getClient()` ([#41079](https://github.com/laravel/framework/pull/41079)) - Added Support for enum in Builder::whereRelation ([#41091](https://github.com/laravel/framework/pull/41091)) - Added X headers when using Mail::alwaysTo ([#41101](https://github.com/laravel/framework/pull/41101)) - Added of support Bitwise operators in query ([#41112](https://github.com/laravel/framework/pull/41112)) - Integrate Laravel CORS into framework ([#41137](https://github.com/laravel/framework/pull/41137)) -- Added `Illuminate/Support/Str::betweenFirst()` ([#41144](https://github.com/laravel/framework/pull/41144)) +- Added `Illuminate\Support\Str::betweenFirst()` ([#41144](https://github.com/laravel/framework/pull/41144)) - Allow specifiying custom messages for Rule objects ([#41145](https://github.com/laravel/framework/pull/41145)) ### Fixed @@ -34,7 +34,7 @@ - Cursor pagination: convert original column to expression ([#41003](https://github.com/laravel/framework/pull/41003)) - Cast $perPage to integer on Paginator ([#41073](https://github.com/laravel/framework/pull/41073)) - Restore S3 client extra options ([#41097](https://github.com/laravel/framework/pull/41097)) -- Use `latest()` within `notifications()` in `Illuminate/Notifications/HasDatabaseNotifications.php` ([#41095](https://github.com/laravel/framework/pull/41095)) +- Use `latest()` within `notifications()` in `Illuminate\Notifications\HasDatabaseNotifications.php` ([#41095](https://github.com/laravel/framework/pull/41095)) - Remove duplicate queries to find batch ([#41121](https://github.com/laravel/framework/pull/41121)) - Remove redundant check in FormRequest::validated() ([#41115](https://github.com/laravel/framework/pull/41115)) - Illuminate/Support/Facades/Storage::fake() changed ([#41113](https://github.com/laravel/framework/pull/41113))
false
Other
laravel
framework
03e3a807fd8d5c2524800dcd8f7a57753330be67.json
Fix migrations $connection property (#41161) Despite being documented as allowing `Schema` queries to run on the given secondary connection, `Schema::connection()` must also be explicitly called to avoid `up()` and `down()` queries to be run on the default database connection. Instead this property is only used by the migrator when wrapping `DB::transaction()` & `DB::pretend()`. The queries still run on the default database connection (or the command option --database.) This change makes queries run using that $connection while not affecting the migrations repository. i.e., the connection for the `migrations` history table. If another `Schema::connection()` is called during `up()` or `down()`, that will be used instead of `$connection`. $connection also overrides MigrateCommand option '--database'. A breaking change is required to switch to the opposite behavior.
src/Illuminate/Database/Migrations/Migrator.php
@@ -387,11 +387,11 @@ protected function runMigration($migration, $method) $migration->getConnection() ); - $callback = function () use ($migration, $method) { + $callback = function () use ($connection, $migration, $method) { if (method_exists($migration, $method)) { $this->fireMigrationEvent(new MigrationStarted($migration, $method)); - $migration->{$method}(); + $this->runMethod($connection, $migration, $method); $this->fireMigrationEvent(new MigrationEnded($migration, $method)); } @@ -447,13 +447,34 @@ protected function getQueries($migration, $method) $migration->getConnection() ); - return $db->pretend(function () use ($migration, $method) { + return $db->pretend(function () use ($db, $migration, $method) { if (method_exists($migration, $method)) { - $migration->{$method}(); + $this->runMethod($db, $migration, $method); } }); } + /** + * Run a migration method on the given connection. + * + * @param \Illuminate\Database\Connection $connection + * @param object $migration + * @param string $method + * @return void + */ + protected function runMethod($connection, $migration, $method) + { + $previousConnection = $this->resolver->getDefaultConnection(); + + try { + $this->resolver->setDefaultConnection($connection->getName()); + + $migration->{$method}(); + } finally { + $this->resolver->setDefaultConnection($previousConnection); + } + } + /** * Resolve a migration instance from a file. *
true
Other
laravel
framework
03e3a807fd8d5c2524800dcd8f7a57753330be67.json
Fix migrations $connection property (#41161) Despite being documented as allowing `Schema` queries to run on the given secondary connection, `Schema::connection()` must also be explicitly called to avoid `up()` and `down()` queries to be run on the default database connection. Instead this property is only used by the migrator when wrapping `DB::transaction()` & `DB::pretend()`. The queries still run on the default database connection (or the command option --database.) This change makes queries run using that $connection while not affecting the migrations repository. i.e., the connection for the `migrations` history table. If another `Schema::connection()` is called during `up()` or `down()`, that will be used instead of `$connection`. $connection also overrides MigrateCommand option '--database'. A breaking change is required to switch to the opposite behavior.
tests/Database/DatabaseMigratorIntegrationTest.php
@@ -37,6 +37,11 @@ protected function setUp(): void 'database' => ':memory:', ], 'sqlite2'); + $db->addConnection([ + 'driver' => 'sqlite', + 'database' => ':memory:', + ], 'sqlite3'); + $db->setAsGlobal(); $container = new Container; @@ -84,6 +89,55 @@ public function testBasicMigrationOfSingleFolder() $this->assertTrue(Str::contains($ran[1], 'password_resets')); } + public function testMigrationsDefaultConnectionCanBeChanged() + { + $ran = $this->migrator->usingConnection('sqlite2', function () { + return $this->migrator->run([__DIR__.'/migrations/one'], ['database' => 'sqllite3']); + }); + + $this->assertFalse($this->db->schema()->hasTable('users')); + $this->assertFalse($this->db->schema()->hasTable('password_resets')); + $this->assertTrue($this->db->schema('sqlite2')->hasTable('users')); + $this->assertTrue($this->db->schema('sqlite2')->hasTable('password_resets')); + $this->assertFalse($this->db->schema('sqlite3')->hasTable('users')); + $this->assertFalse($this->db->schema('sqlite3')->hasTable('password_resets')); + + $this->assertTrue(Str::contains($ran[0], 'users')); + $this->assertTrue(Str::contains($ran[1], 'password_resets')); + } + + public function testMigrationsCanEachDefineConnection() + { + $ran = $this->migrator->run([__DIR__.'/migrations/connection_configured']); + + $this->assertFalse($this->db->schema()->hasTable('failed_jobs')); + $this->assertFalse($this->db->schema()->hasTable('jobs')); + $this->assertFalse($this->db->schema('sqlite2')->hasTable('failed_jobs')); + $this->assertFalse($this->db->schema('sqlite2')->hasTable('jobs')); + $this->assertTrue($this->db->schema('sqlite3')->hasTable('failed_jobs')); + $this->assertTrue($this->db->schema('sqlite3')->hasTable('jobs')); + + $this->assertTrue(Str::contains($ran[0], 'failed_jobs')); + $this->assertTrue(Str::contains($ran[1], 'jobs')); + } + + public function testMigratorCannotChangeDefinedMigrationConnection() + { + $ran = $this->migrator->usingConnection('sqlite2', function () { + return $this->migrator->run([__DIR__.'/migrations/connection_configured']); + }); + + $this->assertFalse($this->db->schema()->hasTable('failed_jobs')); + $this->assertFalse($this->db->schema()->hasTable('jobs')); + $this->assertFalse($this->db->schema('sqlite2')->hasTable('failed_jobs')); + $this->assertFalse($this->db->schema('sqlite2')->hasTable('jobs')); + $this->assertTrue($this->db->schema('sqlite3')->hasTable('failed_jobs')); + $this->assertTrue($this->db->schema('sqlite3')->hasTable('jobs')); + + $this->assertTrue(Str::contains($ran[0], 'failed_jobs')); + $this->assertTrue(Str::contains($ran[1], 'jobs')); + } + public function testMigrationsCanBeRolledBack() { $this->migrator->run([__DIR__.'/migrations/one']);
true
Other
laravel
framework
03e3a807fd8d5c2524800dcd8f7a57753330be67.json
Fix migrations $connection property (#41161) Despite being documented as allowing `Schema` queries to run on the given secondary connection, `Schema::connection()` must also be explicitly called to avoid `up()` and `down()` queries to be run on the default database connection. Instead this property is only used by the migrator when wrapping `DB::transaction()` & `DB::pretend()`. The queries still run on the default database connection (or the command option --database.) This change makes queries run using that $connection while not affecting the migrations repository. i.e., the connection for the `migrations` history table. If another `Schema::connection()` is called during `up()` or `down()`, that will be used instead of `$connection`. $connection also overrides MigrateCommand option '--database'. A breaking change is required to switch to the opposite behavior.
tests/Database/migrations/connection_configured/2022_02_21_000000_create_failed_jobs_table.php
@@ -0,0 +1,42 @@ +<?php + +use Illuminate\Database\Migrations\Migration; +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; + +return new class extends Migration +{ + /** + * The database connection that should be used by the migration. + * + * @var string + */ + protected $connection = 'sqlite3'; + + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('failed_jobs', function (Blueprint $table) { + $table->id(); + $table->text('connection'); + $table->text('queue'); + $table->longText('payload'); + $table->longText('exception'); + $table->timestamp('failed_at')->useCurrent(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('failed_jobs'); + } +};
true
Other
laravel
framework
03e3a807fd8d5c2524800dcd8f7a57753330be67.json
Fix migrations $connection property (#41161) Despite being documented as allowing `Schema` queries to run on the given secondary connection, `Schema::connection()` must also be explicitly called to avoid `up()` and `down()` queries to be run on the default database connection. Instead this property is only used by the migrator when wrapping `DB::transaction()` & `DB::pretend()`. The queries still run on the default database connection (or the command option --database.) This change makes queries run using that $connection while not affecting the migrations repository. i.e., the connection for the `migrations` history table. If another `Schema::connection()` is called during `up()` or `down()`, that will be used instead of `$connection`. $connection also overrides MigrateCommand option '--database'. A breaking change is required to switch to the opposite behavior.
tests/Database/migrations/connection_configured/2022_02_21_120000_create_jobs_table.php
@@ -0,0 +1,36 @@ +<?php + +use Illuminate\Database\Migrations\Migration; +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; + +return new class extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::connection('sqlite3')->create('jobs', function (Blueprint $table) { + $table->bigIncrements('id'); + $table->string('queue')->index(); + $table->longText('payload'); + $table->unsignedTinyInteger('attempts'); + $table->unsignedInteger('reserved_at')->nullable(); + $table->unsignedInteger('available_at'); + $table->unsignedInteger('created_at'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::connection('sqlite3')->dropIfExists('jobs'); + } +};
true
Other
laravel
framework
4c95784ed7de0ec8809072f3c8e16d8b9847fc28.json
Enforce stricter assertions. (#41165)
tests/Cache/CacheManagerTest.php
@@ -56,7 +56,7 @@ public function testCustomDriverOverridesInternalDrivers() $driver = $cacheManager->store('my_store'); - $this->assertEquals('mm(u_u)mm', $driver->flag); + $this->assertSame('mm(u_u)mm', $driver->flag); } public function testItMakesRepositoryWhenContainerHasNoDispatcher()
true
Other
laravel
framework
4c95784ed7de0ec8809072f3c8e16d8b9847fc28.json
Enforce stricter assertions. (#41165)
tests/Cache/CacheRateLimiterTest.php
@@ -105,7 +105,7 @@ public function testAttemptsCallbackReturnsCallbackReturn() $rateLimiter = new RateLimiter($cache); - $this->assertEquals('foo', $rateLimiter->attempt('key', 1, function () { + $this->assertSame('foo', $rateLimiter->attempt('key', 1, function () { return 'foo'; }, 1)); }
true
Other
laravel
framework
4c95784ed7de0ec8809072f3c8e16d8b9847fc28.json
Enforce stricter assertions. (#41165)
tests/Console/ConsoleEventSchedulerTest.php
@@ -124,15 +124,15 @@ public function testItUsesCommandDescriptionAsEventDescription() { $schedule = $this->schedule; $event = $schedule->command(ConsoleCommandStub::class); - $this->assertEquals('This is a description about the command', $event->description); + $this->assertSame('This is a description about the command', $event->description); } public function testItShouldBePossibleToOverwriteTheDescription() { $schedule = $this->schedule; $event = $schedule->command(ConsoleCommandStub::class) ->description('This is an alternative description'); - $this->assertEquals('This is an alternative description', $event->description); + $this->assertSame('This is an alternative description', $event->description); } public function testCallCreatesNewJobWithTimezone()
true
Other
laravel
framework
4c95784ed7de0ec8809072f3c8e16d8b9847fc28.json
Enforce stricter assertions. (#41165)
tests/Cookie/CookieTest.php
@@ -120,10 +120,10 @@ public function testExpire() $cookieJar->expire('foobar', '/path', '/domain'); $cookie = $cookieJar->queued('foobar'); - $this->assertEquals('foobar', $cookie->getName()); + $this->assertSame('foobar', $cookie->getName()); $this->assertEquals(null, $cookie->getValue()); - $this->assertEquals('/path', $cookie->getPath()); - $this->assertEquals('/domain', $cookie->getDomain()); + $this->assertSame('/path', $cookie->getPath()); + $this->assertSame('/domain', $cookie->getDomain()); $this->assertTrue($cookie->getExpiresTime() < time()); $this->assertCount(1, $cookieJar->getQueuedCookies()); }
true
Other
laravel
framework
4c95784ed7de0ec8809072f3c8e16d8b9847fc28.json
Enforce stricter assertions. (#41165)
tests/Database/DatabaseEloquentBelongsToManySyncReturnValueTypeTest.php
@@ -90,7 +90,7 @@ public function testSyncReturnValueType() }); $user->articles->each(function (BelongsToManySyncTestTestArticle $article) { - $this->assertEquals('0', $article->pivot->visible); + $this->assertSame('0', (string) $article->pivot->visible); }); } @@ -108,7 +108,7 @@ public function testSyncWithPivotDefaultsReturnValueType() }); $user->articles->each(function (BelongsToManySyncTestTestArticle $article) { - $this->assertEquals('1', $article->pivot->visible); + $this->assertSame('1', (string) $article->pivot->visible); }); }
true
Other
laravel
framework
4c95784ed7de0ec8809072f3c8e16d8b9847fc28.json
Enforce stricter assertions. (#41165)
tests/Database/DatabaseEloquentBelongsToManySyncTouchesParentTest.php
@@ -89,7 +89,7 @@ public function testSyncWithDetachedValuesShouldTouch() Carbon::setTestNow('2021-07-20 19:13:14'); $result = $article->users()->sync([1, 2]); $this->assertCount(1, collect($result['detached'])); - $this->assertSame('3', collect($result['detached'])->first()); + $this->assertSame('3', (string) collect($result['detached'])->first()); $article->refresh(); $this->assertSame('2021-07-20 19:13:14', $article->updated_at->format('Y-m-d H:i:s'));
true
Other
laravel
framework
4c95784ed7de0ec8809072f3c8e16d8b9847fc28.json
Enforce stricter assertions. (#41165)
tests/Database/DatabaseEloquentBelongsToTest.php
@@ -127,7 +127,7 @@ public function __toString() $this->assertEquals(1, $models[0]->foo->getAttribute('id')); $this->assertEquals(2, $models[1]->foo->getAttribute('id')); - $this->assertEquals('3', $models[2]->foo->getAttribute('id')); + $this->assertSame('3', (string) $models[2]->foo->getAttribute('id')); } public function testAssociateMethodSetsForeignKeyOnModel()
true
Other
laravel
framework
4c95784ed7de0ec8809072f3c8e16d8b9847fc28.json
Enforce stricter assertions. (#41165)
tests/Database/DatabaseEloquentHasOneTest.php
@@ -183,7 +183,7 @@ public function __toString() $this->assertEquals(1, $models[0]->foo->foreign_key); $this->assertEquals(2, $models[1]->foo->foreign_key); $this->assertNull($models[2]->foo); - $this->assertEquals('4', $models[3]->foo->foreign_key); + $this->assertSame('4', (string) $models[3]->foo->foreign_key); } public function testRelationCountQueryCanBeBuilt()
true
Other
laravel
framework
4c95784ed7de0ec8809072f3c8e16d8b9847fc28.json
Enforce stricter assertions. (#41165)
tests/Database/DatabaseEloquentStrictMorphsTest.php
@@ -34,7 +34,7 @@ public function testStrictModeDoesNotThrowExceptionWhenMorphMap() ]); $morphName = $model->getMorphClass(); - $this->assertEquals('test', $morphName); + $this->assertSame('test', $morphName); } public function testMapsCanBeEnforcedInOneMethod() @@ -48,7 +48,7 @@ public function testMapsCanBeEnforcedInOneMethod() ]); $morphName = $model->getMorphClass(); - $this->assertEquals('test', $morphName); + $this->assertSame('test', $morphName); } protected function tearDown(): void
true
Other
laravel
framework
4c95784ed7de0ec8809072f3c8e16d8b9847fc28.json
Enforce stricter assertions. (#41165)
tests/Foundation/FoundationFormRequestTest.php
@@ -135,7 +135,7 @@ public function testValidatedMethodReturnsOnlyRequestedValidatedData() $request->validateResolved(); - $this->assertEquals('specified', $request->validated('name')); + $this->assertSame('specified', $request->validated('name')); } public function testValidatedMethodReturnsOnlyRequestedNestedValidatedData() @@ -146,7 +146,7 @@ public function testValidatedMethodReturnsOnlyRequestedNestedValidatedData() $request->validateResolved(); - $this->assertEquals('bar', $request->validated('nested.foo')); + $this->assertSame('bar', $request->validated('nested.foo')); } /**
true
Other
laravel
framework
4c95784ed7de0ec8809072f3c8e16d8b9847fc28.json
Enforce stricter assertions. (#41165)
tests/Foundation/Testing/Concerns/InteractsWithViewsTest.php
@@ -14,7 +14,7 @@ public function testBladeCorrectlyRendersString() { $string = (string) $this->blade('@if(true)test @endif'); - $this->assertEquals('test ', $string); + $this->assertSame('test ', $string); } public function testComponentCanAccessPublicProperties() @@ -36,8 +36,8 @@ public function render() $component = $this->component(get_class($exampleComponent)); - $this->assertEquals('bar', $component->foo); - $this->assertEquals('hello', $component->speak()); + $this->assertSame('bar', $component->foo); + $this->assertSame('hello', $component->speak()); $component->assertSee('content'); } }
true
Other
laravel
framework
4c95784ed7de0ec8809072f3c8e16d8b9847fc28.json
Enforce stricter assertions. (#41165)
tests/Http/Middleware/TrustProxiesTest.php
@@ -26,9 +26,9 @@ public function test_request_does_not_trust() { $req = $this->createProxiedRequest(); - $this->assertEquals('192.168.10.10', $req->getClientIp(), 'Assert untrusted proxy x-forwarded-for header not used'); - $this->assertEquals('http', $req->getScheme(), 'Assert untrusted proxy x-forwarded-proto header not used'); - $this->assertEquals('localhost', $req->getHost(), 'Assert untrusted proxy x-forwarded-host header not used'); + $this->assertSame('192.168.10.10', $req->getClientIp(), 'Assert untrusted proxy x-forwarded-for header not used'); + $this->assertSame('http', $req->getScheme(), 'Assert untrusted proxy x-forwarded-proto header not used'); + $this->assertSame('localhost', $req->getHost(), 'Assert untrusted proxy x-forwarded-host header not used'); $this->assertEquals(8888, $req->getPort(), 'Assert untrusted proxy x-forwarded-port header not used'); $this->assertSame('', $req->getBaseUrl(), 'Assert untrusted proxy x-forwarded-prefix header not used'); } @@ -44,11 +44,11 @@ public function test_does_trust_trusted_proxy() $req = $this->createProxiedRequest(); $req->setTrustedProxies(['192.168.10.10'], $this->headerAll); - $this->assertEquals('173.174.200.38', $req->getClientIp(), 'Assert trusted proxy x-forwarded-for header used'); - $this->assertEquals('https', $req->getScheme(), 'Assert trusted proxy x-forwarded-proto header used'); - $this->assertEquals('serversforhackers.com', $req->getHost(), 'Assert trusted proxy x-forwarded-host header used'); + $this->assertSame('173.174.200.38', $req->getClientIp(), 'Assert trusted proxy x-forwarded-for header used'); + $this->assertSame('https', $req->getScheme(), 'Assert trusted proxy x-forwarded-proto header used'); + $this->assertSame('serversforhackers.com', $req->getHost(), 'Assert trusted proxy x-forwarded-host header used'); $this->assertEquals(443, $req->getPort(), 'Assert trusted proxy x-forwarded-port header used'); - $this->assertEquals('/prefix', $req->getBaseUrl(), 'Assert trusted proxy x-forwarded-prefix header used'); + $this->assertSame('/prefix', $req->getBaseUrl(), 'Assert trusted proxy x-forwarded-prefix header used'); } /** @@ -61,7 +61,7 @@ public function test_trusted_proxy_sets_trusted_proxies_with_wildcard() $request = $this->createProxiedRequest(); $trustedProxy->handle($request, function ($request) { - $this->assertEquals('173.174.200.38', $request->getClientIp(), 'Assert trusted proxy x-forwarded-for header used with wildcard proxy setting'); + $this->assertSame('173.174.200.38', $request->getClientIp(), 'Assert trusted proxy x-forwarded-for header used with wildcard proxy setting'); }); } @@ -75,7 +75,7 @@ public function test_trusted_proxy_sets_trusted_proxies_with_double_wildcard_for $request = $this->createProxiedRequest(); $trustedProxy->handle($request, function ($request) { - $this->assertEquals('173.174.200.38', $request->getClientIp(), 'Assert trusted proxy x-forwarded-for header used with wildcard proxy setting'); + $this->assertSame('173.174.200.38', $request->getClientIp(), 'Assert trusted proxy x-forwarded-for header used with wildcard proxy setting'); }); } @@ -89,7 +89,7 @@ public function test_trusted_proxy_sets_trusted_proxies() $request = $this->createProxiedRequest(); $trustedProxy->handle($request, function ($request) { - $this->assertEquals('173.174.200.38', $request->getClientIp(), 'Assert trusted proxy x-forwarded-for header used'); + $this->assertSame('173.174.200.38', $request->getClientIp(), 'Assert trusted proxy x-forwarded-for header used'); }); } @@ -112,7 +112,7 @@ public function test_get_client_ips() $trustedProxy->handle($request, function ($request) use ($forwardedForHeader) { $ips = $request->getClientIps(); - $this->assertEquals('192.0.2.2', end($ips), 'Assert sets the '.$forwardedForHeader); + $this->assertSame('192.0.2.2', end($ips), 'Assert sets the '.$forwardedForHeader); }); } } @@ -135,7 +135,7 @@ public function test_get_client_ip_with_muliple_ip_addresses_some_of_which_are_t $request = $this->createProxiedRequest(['HTTP_X_FORWARDED_FOR' => $forwardedForHeader]); $trustedProxy->handle($request, function ($request) use ($forwardedForHeader) { - $this->assertEquals('192.0.2.2', $request->getClientIp(), 'Assert sets the '.$forwardedForHeader); + $this->assertSame('192.0.2.2', $request->getClientIp(), 'Assert sets the '.$forwardedForHeader); }); } } @@ -158,7 +158,7 @@ public function test_get_client_ip_with_muliple_ip_addresses_all_proxies_are_tru $request = $this->createProxiedRequest(['HTTP_X_FORWARDED_FOR' => $forwardedForHeader]); $trustedProxy->handle($request, function ($request) use ($forwardedForHeader) { - $this->assertEquals('192.0.2.2', $request->getClientIp(), 'Assert sets the '.$forwardedForHeader); + $this->assertSame('192.0.2.2', $request->getClientIp(), 'Assert sets the '.$forwardedForHeader); }); } } @@ -179,11 +179,11 @@ public function test_can_distrust_headers() ]); $trustedProxy->handle($request, function ($request) { - $this->assertEquals('173.174.200.40', $request->getClientIp(), + $this->assertSame('173.174.200.40', $request->getClientIp(), 'Assert trusted proxy used forwarded header for IP'); - $this->assertEquals('https', $request->getScheme(), + $this->assertSame('https', $request->getScheme(), 'Assert trusted proxy used forwarded header for scheme'); - $this->assertEquals('serversforhackers.com', $request->getHost(), + $this->assertSame('serversforhackers.com', $request->getHost(), 'Assert trusted proxy used forwarded header for host'); $this->assertEquals(443, $request->getPort(), 'Assert trusted proxy used forwarded header for port'); }); @@ -199,11 +199,11 @@ public function test_x_forwarded_for_header_only_trusted() $request = $this->createProxiedRequest(); $trustedProxy->handle($request, function ($request) { - $this->assertEquals('173.174.200.38', $request->getClientIp(), + $this->assertSame('173.174.200.38', $request->getClientIp(), 'Assert trusted proxy used forwarded header for IP'); - $this->assertEquals('http', $request->getScheme(), + $this->assertSame('http', $request->getScheme(), 'Assert trusted proxy did not use forwarded header for scheme'); - $this->assertEquals('localhost', $request->getHost(), + $this->assertSame('localhost', $request->getHost(), 'Assert trusted proxy did not use forwarded header for host'); $this->assertEquals(8888, $request->getPort(), 'Assert trusted proxy did not use forwarded header for port'); $this->assertSame('', $request->getBaseUrl(), 'Assert trusted proxy did not use forwarded header for prefix'); @@ -220,11 +220,11 @@ public function test_x_forwarded_host_header_only_trusted() $request = $this->createProxiedRequest(['HTTP_X_FORWARDED_HOST' => 'serversforhackers.com:8888']); $trustedProxy->handle($request, function ($request) { - $this->assertEquals('192.168.10.10', $request->getClientIp(), + $this->assertSame('192.168.10.10', $request->getClientIp(), 'Assert trusted proxy did not use forwarded header for IP'); - $this->assertEquals('http', $request->getScheme(), + $this->assertSame('http', $request->getScheme(), 'Assert trusted proxy did not use forwarded header for scheme'); - $this->assertEquals('serversforhackers.com', $request->getHost(), + $this->assertSame('serversforhackers.com', $request->getHost(), 'Assert trusted proxy used forwarded header for host'); $this->assertEquals(8888, $request->getPort(), 'Assert trusted proxy did not use forwarded header for port'); $this->assertSame('', $request->getBaseUrl(), 'Assert trusted proxy did not use forwarded header for prefix'); @@ -241,11 +241,11 @@ public function test_x_forwarded_port_header_only_trusted() $request = $this->createProxiedRequest(); $trustedProxy->handle($request, function ($request) { - $this->assertEquals('192.168.10.10', $request->getClientIp(), + $this->assertSame('192.168.10.10', $request->getClientIp(), 'Assert trusted proxy did not use forwarded header for IP'); - $this->assertEquals('http', $request->getScheme(), + $this->assertSame('http', $request->getScheme(), 'Assert trusted proxy did not use forwarded header for scheme'); - $this->assertEquals('localhost', $request->getHost(), + $this->assertSame('localhost', $request->getHost(), 'Assert trusted proxy did not use forwarded header for host'); $this->assertEquals(443, $request->getPort(), 'Assert trusted proxy used forwarded header for port'); $this->assertSame('', $request->getBaseUrl(), 'Assert trusted proxy did not use forwarded header for prefix'); @@ -262,14 +262,14 @@ public function test_x_forwarded_prefix_header_only_trusted() $request = $this->createProxiedRequest(); $trustedProxy->handle($request, function ($request) { - $this->assertEquals('192.168.10.10', $request->getClientIp(), + $this->assertSame('192.168.10.10', $request->getClientIp(), 'Assert trusted proxy did not use forwarded header for IP'); - $this->assertEquals('http', $request->getScheme(), + $this->assertSame('http', $request->getScheme(), 'Assert trusted proxy did not use forwarded header for scheme'); - $this->assertEquals('localhost', $request->getHost(), + $this->assertSame('localhost', $request->getHost(), 'Assert trusted proxy did not use forwarded header for host'); $this->assertEquals(8888, $request->getPort(), 'Assert trusted proxy did not use forwarded header for port'); - $this->assertEquals('/prefix', $request->getBaseUrl(), 'Assert trusted proxy used forwarded header for prefix'); + $this->assertSame('/prefix', $request->getBaseUrl(), 'Assert trusted proxy used forwarded header for prefix'); }); } @@ -283,11 +283,11 @@ public function test_x_forwarded_proto_header_only_trusted() $request = $this->createProxiedRequest(); $trustedProxy->handle($request, function ($request) { - $this->assertEquals('192.168.10.10', $request->getClientIp(), + $this->assertSame('192.168.10.10', $request->getClientIp(), 'Assert trusted proxy did not use forwarded header for IP'); - $this->assertEquals('https', $request->getScheme(), + $this->assertSame('https', $request->getScheme(), 'Assert trusted proxy used forwarded header for scheme'); - $this->assertEquals('localhost', $request->getHost(), + $this->assertSame('localhost', $request->getHost(), 'Assert trusted proxy did not use forwarded header for host'); $this->assertEquals(8888, $request->getPort(), 'Assert trusted proxy did not use forwarded header for port'); $this->assertSame('', $request->getBaseUrl(), 'Assert trusted proxy did not use forwarded header for prefix'); @@ -309,14 +309,14 @@ public function test_x_forwarded_multiple_individual_headers_trusted() $request = $this->createProxiedRequest(); $trustedProxy->handle($request, function ($request) { - $this->assertEquals('173.174.200.38', $request->getClientIp(), + $this->assertSame('173.174.200.38', $request->getClientIp(), 'Assert trusted proxy used forwarded header for IP'); - $this->assertEquals('https', $request->getScheme(), + $this->assertSame('https', $request->getScheme(), 'Assert trusted proxy used forwarded header for scheme'); - $this->assertEquals('serversforhackers.com', $request->getHost(), + $this->assertSame('serversforhackers.com', $request->getHost(), 'Assert trusted proxy used forwarded header for host'); $this->assertEquals(443, $request->getPort(), 'Assert trusted proxy used forwarded header for port'); - $this->assertEquals('/prefix', $request->getBaseUrl(), 'Assert trusted proxy used forwarded header for prefix'); + $this->assertSame('/prefix', $request->getBaseUrl(), 'Assert trusted proxy used forwarded header for prefix'); }); }
true
Other
laravel
framework
4c95784ed7de0ec8809072f3c8e16d8b9847fc28.json
Enforce stricter assertions. (#41165)
tests/Integration/Database/DatabaseCustomCastsTest.php
@@ -37,7 +37,7 @@ public function test_custom_casting() $this->assertEquals(['name' => 'Taylor'], $model->array_object->toArray()); $this->assertEquals(['name' => 'Taylor'], $model->collection->toArray()); - $this->assertEquals('Taylor', (string) $model->stringable); + $this->assertSame('Taylor', (string) $model->stringable); $model->array_object['age'] = 34; $model->array_object['meta']['title'] = 'Developer';
true
Other
laravel
framework
4c95784ed7de0ec8809072f3c8e16d8b9847fc28.json
Enforce stricter assertions. (#41165)
tests/Integration/Database/DatabaseEloquentBroadcastingTest.php
@@ -47,7 +47,7 @@ public function testChannelRouteFormatting() { $model = new TestEloquentBroadcastUser; - $this->assertEquals('Illuminate.Tests.Integration.Database.TestEloquentBroadcastUser.{testEloquentBroadcastUser}', $model->broadcastChannelRoute()); + $this->assertSame('Illuminate.Tests.Integration.Database.TestEloquentBroadcastUser.{testEloquentBroadcastUser}', $model->broadcastChannelRoute()); } public function testBroadcastingOnModelTrashing()
true
Other
laravel
framework
4c95784ed7de0ec8809072f3c8e16d8b9847fc28.json
Enforce stricter assertions. (#41165)
tests/Integration/Database/EloquentBelongsToManyTest.php
@@ -138,7 +138,7 @@ public function testCustomPivotClass() $post->tagsWithCustomPivot()->attach($tag->id); $this->assertInstanceOf(PostTagPivot::class, $post->tagsWithCustomPivot[0]->pivot); - $this->assertEquals('1507630210', $post->tagsWithCustomPivot[0]->pivot->created_at); + $this->assertSame('1507630210', $post->tagsWithCustomPivot[0]->pivot->created_at); $this->assertInstanceOf(PostTagPivot::class, $post->tagsWithCustomPivotClass[0]->pivot); $this->assertSame('posts_tags', $post->tagsWithCustomPivotClass()->getTable()); @@ -233,8 +233,8 @@ public function testCustomPivotClassUpdatesTimestamps() ); foreach ($post->tagsWithCustomExtraPivot as $tag) { $this->assertSame('exclude', $tag->pivot->flag); - $this->assertEquals('2017-10-10 10:10:10', $tag->pivot->getAttributes()['created_at']); - $this->assertEquals('2017-10-10 10:10:20', $tag->pivot->getAttributes()['updated_at']); // +10 seconds + $this->assertSame('2017-10-10 10:10:10', $tag->pivot->getAttributes()['created_at']); + $this->assertSame('2017-10-10 10:10:20', $tag->pivot->getAttributes()['updated_at']); // +10 seconds } }
true
Other
laravel
framework
4c95784ed7de0ec8809072f3c8e16d8b9847fc28.json
Enforce stricter assertions. (#41165)
tests/Integration/Database/EloquentCollectionLoadCountTest.php
@@ -47,9 +47,9 @@ public function testLoadCount() $posts->loadCount('comments'); $this->assertCount(1, DB::getQueryLog()); - $this->assertEquals('2', $posts[0]->comments_count); - $this->assertEquals('0', $posts[1]->comments_count); - $this->assertEquals('2', $posts[0]->getOriginal('comments_count')); + $this->assertSame('2', (string) $posts[0]->comments_count); + $this->assertSame('0', (string) $posts[1]->comments_count); + $this->assertSame('2', (string) $posts[0]->getOriginal('comments_count')); } public function testLoadCountWithSameModels() @@ -61,9 +61,9 @@ public function testLoadCountWithSameModels() $posts->loadCount('comments'); $this->assertCount(1, DB::getQueryLog()); - $this->assertEquals('2', $posts[0]->comments_count); - $this->assertEquals('0', $posts[1]->comments_count); - $this->assertEquals('2', $posts[2]->comments_count); + $this->assertSame('2', (string) $posts[0]->comments_count); + $this->assertSame('0', (string) $posts[1]->comments_count); + $this->assertSame('2', (string) $posts[2]->comments_count); } public function testLoadCountOnDeletedModels() @@ -75,8 +75,8 @@ public function testLoadCountOnDeletedModels() $posts->loadCount('comments'); $this->assertCount(1, DB::getQueryLog()); - $this->assertEquals('2', $posts[0]->comments_count); - $this->assertEquals('0', $posts[1]->comments_count); + $this->assertSame('2', (string) $posts[0]->comments_count); + $this->assertSame('0', (string) $posts[1]->comments_count); } public function testLoadCountWithArrayOfRelations() @@ -88,10 +88,10 @@ public function testLoadCountWithArrayOfRelations() $posts->loadCount(['comments', 'likes']); $this->assertCount(1, DB::getQueryLog()); - $this->assertEquals('2', $posts[0]->comments_count); - $this->assertEquals('1', $posts[0]->likes_count); - $this->assertEquals('0', $posts[1]->comments_count); - $this->assertEquals('0', $posts[1]->likes_count); + $this->assertSame('2', (string) $posts[0]->comments_count); + $this->assertSame('1', (string) $posts[0]->likes_count); + $this->assertSame('0', (string) $posts[1]->comments_count); + $this->assertSame('0', (string) $posts[1]->likes_count); } public function testLoadCountDoesNotOverrideAttributesWithDefaultValue() @@ -102,7 +102,7 @@ public function testLoadCountDoesNotOverrideAttributesWithDefaultValue() Collection::make([$post])->loadCount('comments'); $this->assertSame(200, $post->some_default_value); - $this->assertEquals('2', $post->comments_count); + $this->assertSame('2', (string) $post->comments_count); } }
true
Other
laravel
framework
4c95784ed7de0ec8809072f3c8e16d8b9847fc28.json
Enforce stricter assertions. (#41165)
tests/Integration/Database/QueryingWithEnumsTest.php
@@ -38,7 +38,7 @@ public function testCanQueryWithEnums() $this->assertNotNull($record); $this->assertNotNull($record2); $this->assertNotNull($record3); - $this->assertEquals('pending', $record->string_status); + $this->assertSame('pending', $record->string_status); $this->assertEquals(1, $record2->integer_status); } @@ -52,7 +52,7 @@ public function testCanInsertWithEnums() $record = DB::table('enum_casts')->where('string_status', StringStatus::pending)->first(); $this->assertNotNull($record); - $this->assertEquals('pending', $record->string_status); + $this->assertSame('pending', $record->string_status); $this->assertEquals(1, $record->integer_status); } }
true
Other
laravel
framework
4c95784ed7de0ec8809072f3c8e16d8b9847fc28.json
Enforce stricter assertions. (#41165)
tests/Integration/Http/Middleware/HandleCorsTest.php
@@ -47,7 +47,7 @@ public function testShouldReturnHeaderAssessControlAllowOriginWhenDontHaveHttpOr 'HTTP_ACCESS_CONTROL_REQUEST_METHOD' => 'POST', ]); - $this->assertEquals('http://localhost', $crawler->headers->get('Access-Control-Allow-Origin')); + $this->assertSame('http://localhost', $crawler->headers->get('Access-Control-Allow-Origin')); $this->assertEquals(204, $crawler->getStatusCode()); } @@ -58,7 +58,7 @@ public function testOptionsAllowOriginAllowed() 'HTTP_ACCESS_CONTROL_REQUEST_METHOD' => 'POST', ]); - $this->assertEquals('http://localhost', $crawler->headers->get('Access-Control-Allow-Origin')); + $this->assertSame('http://localhost', $crawler->headers->get('Access-Control-Allow-Origin')); $this->assertEquals(204, $crawler->getStatusCode()); } @@ -71,7 +71,7 @@ public function testAllowAllOrigins() 'HTTP_ACCESS_CONTROL_REQUEST_METHOD' => 'POST', ]); - $this->assertEquals('*', $crawler->headers->get('Access-Control-Allow-Origin')); + $this->assertSame('*', $crawler->headers->get('Access-Control-Allow-Origin')); $this->assertEquals(204, $crawler->getStatusCode()); } @@ -84,7 +84,7 @@ public function testAllowAllOriginsWildcard() 'HTTP_ACCESS_CONTROL_REQUEST_METHOD' => 'POST', ]); - $this->assertEquals('http://test.laravel.com', $crawler->headers->get('Access-Control-Allow-Origin')); + $this->assertSame('http://test.laravel.com', $crawler->headers->get('Access-Control-Allow-Origin')); $this->assertEquals(204, $crawler->getStatusCode()); } @@ -97,7 +97,7 @@ public function testOriginsWildcardIncludesNestedSubdomains() 'HTTP_ACCESS_CONTROL_REQUEST_METHOD' => 'POST', ]); - $this->assertEquals('http://api.service.test.laravel.com', $crawler->headers->get('Access-Control-Allow-Origin')); + $this->assertSame('http://api.service.test.laravel.com', $crawler->headers->get('Access-Control-Allow-Origin')); $this->assertEquals(204, $crawler->getStatusCode()); } @@ -120,7 +120,7 @@ public function testOptionsAllowOriginAllowedNonExistingRoute() 'HTTP_ACCESS_CONTROL_REQUEST_METHOD' => 'POST', ]); - $this->assertEquals('http://localhost', $crawler->headers->get('Access-Control-Allow-Origin')); + $this->assertSame('http://localhost', $crawler->headers->get('Access-Control-Allow-Origin')); $this->assertEquals(204, $crawler->getStatusCode()); } @@ -131,7 +131,7 @@ public function testOptionsAllowOriginNotAllowed() 'HTTP_ACCESS_CONTROL_REQUEST_METHOD' => 'POST', ]); - $this->assertEquals('http://localhost', $crawler->headers->get('Access-Control-Allow-Origin')); + $this->assertSame('http://localhost', $crawler->headers->get('Access-Control-Allow-Origin')); } public function testAllowMethodAllowed() @@ -143,7 +143,7 @@ public function testAllowMethodAllowed() $this->assertEquals(null, $crawler->headers->get('Access-Control-Allow-Methods')); $this->assertEquals(200, $crawler->getStatusCode()); - $this->assertEquals('PONG', $crawler->getContent()); + $this->assertSame('PONG', $crawler->getContent()); } public function testAllowMethodNotAllowed() @@ -163,10 +163,10 @@ public function testAllowHeaderAllowedOptions() 'HTTP_ACCESS_CONTROL_REQUEST_METHOD' => 'POST', 'HTTP_ACCESS_CONTROL_REQUEST_HEADERS' => 'x-custom-1, x-custom-2', ]); - $this->assertEquals('x-custom-1, x-custom-2', $crawler->headers->get('Access-Control-Allow-Headers')); + $this->assertSame('x-custom-1, x-custom-2', $crawler->headers->get('Access-Control-Allow-Headers')); $this->assertEquals(204, $crawler->getStatusCode()); - $this->assertEquals('', $crawler->getContent()); + $this->assertSame('', $crawler->getContent()); } public function testAllowHeaderAllowedWildcardOptions() @@ -178,10 +178,10 @@ public function testAllowHeaderAllowedWildcardOptions() 'HTTP_ACCESS_CONTROL_REQUEST_METHOD' => 'POST', 'HTTP_ACCESS_CONTROL_REQUEST_HEADERS' => 'x-custom-3', ]); - $this->assertEquals('x-custom-3', $crawler->headers->get('Access-Control-Allow-Headers')); + $this->assertSame('x-custom-3', $crawler->headers->get('Access-Control-Allow-Headers')); $this->assertEquals(204, $crawler->getStatusCode()); - $this->assertEquals('', $crawler->getContent()); + $this->assertSame('', $crawler->getContent()); } public function testAllowHeaderNotAllowedOptions() @@ -191,7 +191,7 @@ public function testAllowHeaderNotAllowedOptions() 'HTTP_ACCESS_CONTROL_REQUEST_METHOD' => 'POST', 'HTTP_ACCESS_CONTROL_REQUEST_HEADERS' => 'x-custom-3', ]); - $this->assertEquals('x-custom-1, x-custom-2', $crawler->headers->get('Access-Control-Allow-Headers')); + $this->assertSame('x-custom-1, x-custom-2', $crawler->headers->get('Access-Control-Allow-Headers')); } public function testAllowHeaderAllowed() @@ -203,7 +203,7 @@ public function testAllowHeaderAllowed() $this->assertEquals(null, $crawler->headers->get('Access-Control-Allow-Headers')); $this->assertEquals(200, $crawler->getStatusCode()); - $this->assertEquals('PONG', $crawler->getContent()); + $this->assertSame('PONG', $crawler->getContent()); } public function testAllowHeaderAllowedWildcard() @@ -217,7 +217,7 @@ public function testAllowHeaderAllowedWildcard() $this->assertEquals(null, $crawler->headers->get('Access-Control-Allow-Headers')); $this->assertEquals(200, $crawler->getStatusCode()); - $this->assertEquals('PONG', $crawler->getContent()); + $this->assertSame('PONG', $crawler->getContent()); } public function testAllowHeaderNotAllowed() @@ -237,7 +237,7 @@ public function testError() 'HTTP_ACCESS_CONTROL_REQUEST_METHOD' => 'POST', ]); - $this->assertEquals('http://localhost', $crawler->headers->get('Access-Control-Allow-Origin')); + $this->assertSame('http://localhost', $crawler->headers->get('Access-Control-Allow-Origin')); $this->assertEquals(500, $crawler->getStatusCode()); } @@ -247,7 +247,7 @@ public function testValidationException() 'HTTP_ORIGIN' => 'http://localhost', 'HTTP_ACCESS_CONTROL_REQUEST_METHOD' => 'POST', ]); - $this->assertEquals('http://localhost', $crawler->headers->get('Access-Control-Allow-Origin')); + $this->assertSame('http://localhost', $crawler->headers->get('Access-Control-Allow-Origin')); $this->assertEquals(302, $crawler->getStatusCode()); }
true
Other
laravel
framework
4c95784ed7de0ec8809072f3c8e16d8b9847fc28.json
Enforce stricter assertions. (#41165)
tests/Integration/Support/MultipleInstanceManagerTest.php
@@ -12,10 +12,10 @@ public function test_configurable_instances_can_be_resolved() $manager = new MultipleInstanceManager($this->app); $fooInstance = $manager->instance('foo'); - $this->assertEquals('option-value', $fooInstance->config['foo-option']); + $this->assertSame('option-value', $fooInstance->config['foo-option']); $barInstance = $manager->instance('bar'); - $this->assertEquals('option-value', $barInstance->config['bar-option']); + $this->assertSame('option-value', $barInstance->config['bar-option']); $duplicateFooInstance = $manager->instance('foo'); $duplicateBarInstance = $manager->instance('bar');
true
Other
laravel
framework
4c95784ed7de0ec8809072f3c8e16d8b9847fc28.json
Enforce stricter assertions. (#41165)
tests/Mail/MailMessageTest.php
@@ -75,7 +75,7 @@ public function testReplyToMethod() public function testSubjectMethod() { $this->assertInstanceOf(Message::class, $message = $this->message->subject('foo')); - $this->assertEquals('foo', $message->getSymfonyMessage()->getSubject()); + $this->assertSame('foo', $message->getSymfonyMessage()->getSubject()); } public function testPriorityMethod() @@ -95,6 +95,6 @@ public function testDataAttachment() $message = new Message(new Email()); $message->attachData('foo', 'foo.jpg', ['mime' => 'image/jpeg']); - $this->assertEquals('foo', $message->getSymfonyMessage()->getAttachments()[0]->getBody()); + $this->assertSame('foo', $message->getSymfonyMessage()->getAttachments()[0]->getBody()); } }
true
Other
laravel
framework
4c95784ed7de0ec8809072f3c8e16d8b9847fc28.json
Enforce stricter assertions. (#41165)
tests/Queue/QueueSyncQueueTest.php
@@ -74,7 +74,7 @@ public function testCreatesPayloadObject() try { $sync->push(new SyncQueueJob()); } catch (LogicException $e) { - $this->assertEquals('extraValue', $e->getMessage()); + $this->assertSame('extraValue', $e->getMessage()); } } }
true
Other
laravel
framework
4c95784ed7de0ec8809072f3c8e16d8b9847fc28.json
Enforce stricter assertions. (#41165)
tests/Routing/RoutingRouteTest.php
@@ -549,7 +549,7 @@ public function testNonGreedyMatches() $route->bind($request1); $this->assertTrue($route->hasParameter('id')); $this->assertFalse($route->hasParameter('foo')); - $this->assertSame('1', $route->parameter('id')); + $this->assertSame('1', (string) $route->parameter('id')); $this->assertSame('png', $route->parameter('ext')); $request2 = Request::create('images/12.png', 'GET'); @@ -857,7 +857,7 @@ public function testDotDoesNotMatchEverything() $request1 = Request::create('images/1.png', 'GET'); $this->assertTrue($route->matches($request1)); $route->bind($request1); - $this->assertSame('1', $route->parameter('id')); + $this->assertSame('1', (string) $route->parameter('id')); $this->assertSame('png', $route->parameter('ext')); $request2 = Request::create('images/12.png', 'GET');
true
Other
laravel
framework
4c95784ed7de0ec8809072f3c8e16d8b9847fc28.json
Enforce stricter assertions. (#41165)
tests/Support/SupportArrTest.php
@@ -861,7 +861,7 @@ public function testToCssClasses() 'mt-4', ]); - $this->assertEquals('font-bold mt-4', $classes); + $this->assertSame('font-bold mt-4', $classes); $classes = Arr::toCssClasses([ 'font-bold', @@ -870,7 +870,7 @@ public function testToCssClasses() 'mr-2' => false, ]); - $this->assertEquals('font-bold mt-4 ml-2', $classes); + $this->assertSame('font-bold mt-4 ml-2', $classes); } public function testWhere()
true
Other
laravel
framework
4c95784ed7de0ec8809072f3c8e16d8b9847fc28.json
Enforce stricter assertions. (#41165)
tests/Support/SupportCollectionTest.php
@@ -2152,31 +2152,31 @@ public function testGetOrPut() { $data = new Collection(['name' => 'taylor', 'email' => 'foo']); - $this->assertEquals('taylor', $data->getOrPut('name', null)); - $this->assertEquals('foo', $data->getOrPut('email', null)); - $this->assertEquals('male', $data->getOrPut('gender', 'male')); + $this->assertSame('taylor', $data->getOrPut('name', null)); + $this->assertSame('foo', $data->getOrPut('email', null)); + $this->assertSame('male', $data->getOrPut('gender', 'male')); - $this->assertEquals('taylor', $data->get('name')); - $this->assertEquals('foo', $data->get('email')); - $this->assertEquals('male', $data->get('gender')); + $this->assertSame('taylor', $data->get('name')); + $this->assertSame('foo', $data->get('email')); + $this->assertSame('male', $data->get('gender')); $data = new Collection(['name' => 'taylor', 'email' => 'foo']); - $this->assertEquals('taylor', $data->getOrPut('name', function () { + $this->assertSame('taylor', $data->getOrPut('name', function () { return null; })); - $this->assertEquals('foo', $data->getOrPut('email', function () { + $this->assertSame('foo', $data->getOrPut('email', function () { return null; })); - $this->assertEquals('male', $data->getOrPut('gender', function () { + $this->assertSame('male', $data->getOrPut('gender', function () { return 'male'; })); - $this->assertEquals('taylor', $data->get('name')); - $this->assertEquals('foo', $data->get('email')); - $this->assertEquals('male', $data->get('gender')); + $this->assertSame('taylor', $data->get('name')); + $this->assertSame('foo', $data->get('email')); + $this->assertSame('male', $data->get('gender')); } public function testPut()
true
Other
laravel
framework
4c95784ed7de0ec8809072f3c8e16d8b9847fc28.json
Enforce stricter assertions. (#41165)
tests/Support/SupportJsTest.php
@@ -12,10 +12,10 @@ class SupportJsTest extends TestCase { public function testScalars() { - $this->assertEquals('false', (string) Js::from(false)); - $this->assertEquals('true', (string) Js::from(true)); - $this->assertEquals('1', (string) Js::from(1)); - $this->assertEquals('1.1', (string) Js::from(1.1)); + $this->assertSame('false', (string) Js::from(false)); + $this->assertSame('true', (string) Js::from(true)); + $this->assertSame('1', (string) Js::from(1)); + $this->assertSame('1.1', (string) Js::from(1.1)); $this->assertEquals( "'\\u003Cdiv class=\\u0022foo\\u0022\\u003E\\u0027quoted html\\u0027\\u003C\\/div\\u003E'", (string) Js::from('<div class="foo">\'quoted html\'</div>')
true
Other
laravel
framework
4c95784ed7de0ec8809072f3c8e16d8b9847fc28.json
Enforce stricter assertions. (#41165)
tests/Support/SupportStringableTest.php
@@ -910,23 +910,23 @@ public function testMarkdown() public function testMask() { - $this->assertEquals('tay*************', $this->stringable('taylor@email.com')->mask('*', 3)); - $this->assertEquals('******@email.com', $this->stringable('taylor@email.com')->mask('*', 0, 6)); - $this->assertEquals('tay*************', $this->stringable('taylor@email.com')->mask('*', -13)); - $this->assertEquals('tay***@email.com', $this->stringable('taylor@email.com')->mask('*', -13, 3)); + $this->assertSame('tay*************', (string) $this->stringable('taylor@email.com')->mask('*', 3)); + $this->assertSame('******@email.com', (string) $this->stringable('taylor@email.com')->mask('*', 0, 6)); + $this->assertSame('tay*************', (string) $this->stringable('taylor@email.com')->mask('*', -13)); + $this->assertSame('tay***@email.com', (string) $this->stringable('taylor@email.com')->mask('*', -13, 3)); - $this->assertEquals('****************', $this->stringable('taylor@email.com')->mask('*', -17)); - $this->assertEquals('*****r@email.com', $this->stringable('taylor@email.com')->mask('*', -99, 5)); + $this->assertSame('****************', (string) $this->stringable('taylor@email.com')->mask('*', -17)); + $this->assertSame('*****r@email.com', (string) $this->stringable('taylor@email.com')->mask('*', -99, 5)); - $this->assertEquals('taylor@email.com', $this->stringable('taylor@email.com')->mask('*', 16)); - $this->assertEquals('taylor@email.com', $this->stringable('taylor@email.com')->mask('*', 16, 99)); + $this->assertSame('taylor@email.com', (string) $this->stringable('taylor@email.com')->mask('*', 16)); + $this->assertSame('taylor@email.com', (string) $this->stringable('taylor@email.com')->mask('*', 16, 99)); - $this->assertEquals('taylor@email.com', $this->stringable('taylor@email.com')->mask('', 3)); + $this->assertSame('taylor@email.com', (string) $this->stringable('taylor@email.com')->mask('', 3)); - $this->assertEquals('taysssssssssssss', $this->stringable('taylor@email.com')->mask('something', 3)); + $this->assertSame('taysssssssssssss', (string) $this->stringable('taylor@email.com')->mask('something', 3)); - $this->assertEquals('这是一***', $this->stringable('这是一段中文')->mask('*', 3)); - $this->assertEquals('**一段中文', $this->stringable('这是一段中文')->mask('*', 0, 2)); + $this->assertSame('这是一***', (string) $this->stringable('这是一段中文')->mask('*', 3)); + $this->assertSame('**一段中文', (string) $this->stringable('这是一段中文')->mask('*', 0, 2)); } public function testRepeat()
true
Other
laravel
framework
4c95784ed7de0ec8809072f3c8e16d8b9847fc28.json
Enforce stricter assertions. (#41165)
tests/Support/ValidatedInputTest.php
@@ -11,8 +11,8 @@ public function test_can_access_input() { $input = new ValidatedInput(['name' => 'Taylor', 'votes' => 100]); - $this->assertEquals('Taylor', $input->name); - $this->assertEquals('Taylor', $input['name']); + $this->assertSame('Taylor', $input->name); + $this->assertSame('Taylor', $input['name']); $this->assertEquals(['name' => 'Taylor'], $input->only(['name'])); $this->assertEquals(['name' => 'Taylor'], $input->except(['votes'])); $this->assertEquals(['name' => 'Taylor', 'votes' => 100], $input->all()); @@ -24,8 +24,8 @@ public function test_can_merge_items() $input = $input->merge(['votes' => 100]); - $this->assertEquals('Taylor', $input->name); - $this->assertEquals('Taylor', $input['name']); + $this->assertSame('Taylor', $input->name); + $this->assertSame('Taylor', $input['name']); $this->assertEquals(['name' => 'Taylor'], $input->only(['name'])); $this->assertEquals(['name' => 'Taylor'], $input->except(['votes'])); $this->assertEquals(['name' => 'Taylor', 'votes' => 100], $input->all());
true
Other
laravel
framework
4c95784ed7de0ec8809072f3c8e16d8b9847fc28.json
Enforce stricter assertions. (#41165)
tests/Testing/ParallelTestingTest.php
@@ -36,7 +36,7 @@ public function testCallbacks($callback) $this->assertNull($testCase); } - $this->assertSame('1', $token); + $this->assertSame('1', (string) $token); $state = true; }); @@ -83,7 +83,7 @@ public function testToken() return '1'; }); - $this->assertSame('1', $parallelTesting->token()); + $this->assertSame('1', (string) $parallelTesting->token()); } public function callbacks()
true
Other
laravel
framework
4c95784ed7de0ec8809072f3c8e16d8b9847fc28.json
Enforce stricter assertions. (#41165)
tests/Testing/TestResponseTest.php
@@ -1627,8 +1627,8 @@ public function testGetDecryptedCookie() $cookie = $response->getCookie('cookie-name', false); $this->assertInstanceOf(Cookie::class, $cookie); - $this->assertEquals('cookie-name', $cookie->getName()); - $this->assertEquals('cookie-value', $cookie->getValue()); + $this->assertSame('cookie-name', $cookie->getName()); + $this->assertSame('cookie-value', $cookie->getValue()); } public function testGetEncryptedCookie()
true
Other
laravel
framework
4c95784ed7de0ec8809072f3c8e16d8b9847fc28.json
Enforce stricter assertions. (#41165)
tests/Validation/ValidationExceptionTest.php
@@ -14,21 +14,21 @@ public function testExceptionSummarizesZeroErrors() { $exception = $this->getException([], []); - $this->assertEquals('The given data was invalid.', $exception->getMessage()); + $this->assertSame('The given data was invalid.', $exception->getMessage()); } public function testExceptionSummarizesOneError() { $exception = $this->getException([], ['foo' => 'required']); - $this->assertEquals('validation.required', $exception->getMessage()); + $this->assertSame('validation.required', $exception->getMessage()); } public function testExceptionSummarizesTwoErrors() { $exception = $this->getException([], ['foo' => 'required', 'bar' => 'required']); - $this->assertEquals('validation.required (and 1 more error)', $exception->getMessage()); + $this->assertSame('validation.required (and 1 more error)', $exception->getMessage()); } public function testExceptionSummarizesThreeOrMoreErrors() @@ -39,7 +39,7 @@ public function testExceptionSummarizesThreeOrMoreErrors() 'baz' => 'required', ]); - $this->assertEquals('validation.required (and 2 more errors)', $exception->getMessage()); + $this->assertSame('validation.required (and 2 more errors)', $exception->getMessage()); } protected function getException($data = [], $rules = [])
true
Other
laravel
framework
4c95784ed7de0ec8809072f3c8e16d8b9847fc28.json
Enforce stricter assertions. (#41165)
tests/Validation/ValidationRuleParserTest.php
@@ -97,7 +97,7 @@ public function testExplodeProperlyParsesSingleRegexRule() ['items.*.type' => 'regex:/^(foo|bar)$/i'] ); - $this->assertEquals('regex:/^(foo|bar)$/i', $exploded->rules['items.0.type'][0]); + $this->assertSame('regex:/^(foo|bar)$/i', $exploded->rules['items.0.type'][0]); } public function testExplodeProperlyParsesRegexWithArrayOfRules() @@ -108,8 +108,8 @@ public function testExplodeProperlyParsesRegexWithArrayOfRules() ['items.*.type' => ['in:foo', 'regex:/^(foo|bar)$/i']] ); - $this->assertEquals('in:foo', $exploded->rules['items.0.type'][0]); - $this->assertEquals('regex:/^(foo|bar)$/i', $exploded->rules['items.0.type'][1]); + $this->assertSame('in:foo', $exploded->rules['items.0.type'][0]); + $this->assertSame('regex:/^(foo|bar)$/i', $exploded->rules['items.0.type'][1]); } public function testExplodeProperlyParsesRegexThatDoesNotContainPipe() @@ -120,8 +120,8 @@ public function testExplodeProperlyParsesRegexThatDoesNotContainPipe() ['items.*.type' => 'in:foo|regex:/^(bar)$/i'] ); - $this->assertEquals('in:foo', $exploded->rules['items.0.type'][0]); - $this->assertEquals('regex:/^(bar)$/i', $exploded->rules['items.0.type'][1]); + $this->assertSame('in:foo', $exploded->rules['items.0.type'][0]); + $this->assertSame('regex:/^(bar)$/i', $exploded->rules['items.0.type'][1]); } public function testExplodeFailsParsingRegexWithOtherRulesInSingleString() @@ -132,9 +132,9 @@ public function testExplodeFailsParsingRegexWithOtherRulesInSingleString() ['items.*.type' => 'in:foo|regex:/^(foo|bar)$/i'] ); - $this->assertEquals('in:foo', $exploded->rules['items.0.type'][0]); - $this->assertEquals('regex:/^(foo', $exploded->rules['items.0.type'][1]); - $this->assertEquals('bar)$/i', $exploded->rules['items.0.type'][2]); + $this->assertSame('in:foo', $exploded->rules['items.0.type'][0]); + $this->assertSame('regex:/^(foo', $exploded->rules['items.0.type'][1]); + $this->assertSame('bar)$/i', $exploded->rules['items.0.type'][2]); } public function testExplodeProperlyFlattensRuleArraysOfArrays() @@ -145,8 +145,8 @@ public function testExplodeProperlyFlattensRuleArraysOfArrays() ['items.*.type' => ['in:foo', [[['regex:/^(foo|bar)$/i']]]]] ); - $this->assertEquals('in:foo', $exploded->rules['items.0.type'][0]); - $this->assertEquals('regex:/^(foo|bar)$/i', $exploded->rules['items.0.type'][1]); + $this->assertSame('in:foo', $exploded->rules['items.0.type'][0]); + $this->assertSame('regex:/^(foo|bar)$/i', $exploded->rules['items.0.type'][1]); } public function testExplodeGeneratesNestedRules() @@ -159,8 +159,8 @@ public function testExplodeGeneratesNestedRules() $results = $parser->explode([ 'users.*.name' => Rule::forEach(function ($value, $attribute, $data) { - $this->assertEquals('Taylor Otwell', $value); - $this->assertEquals('users.0.name', $attribute); + $this->assertSame('Taylor Otwell', $value); + $this->assertSame('users.0.name', $attribute); $this->assertEquals($data['users.0.name'], 'Taylor Otwell'); return [Rule::requiredIf(true)]; @@ -179,8 +179,8 @@ public function testExplodeGeneratesNestedRulesForNonNestedData() $results = $parser->explode([ 'name' => Rule::forEach(function ($value, $attribute, $data = null) { - $this->assertEquals('Taylor Otwell', $value); - $this->assertEquals('name', $attribute); + $this->assertSame('Taylor Otwell', $value); + $this->assertSame('name', $attribute); $this->assertEquals(['name' => 'Taylor Otwell'], $data); return 'required'; @@ -249,18 +249,18 @@ public function testExplodeHandlesRecursivelyNestedRules() $results = $parser->explode([ 'users.*.name' => [ Rule::forEach(function ($value, $attribute, $data) { - $this->assertEquals('Taylor Otwell', $value); - $this->assertEquals('users.0.name', $attribute); + $this->assertSame('Taylor Otwell', $value); + $this->assertSame('users.0.name', $attribute); $this->assertEquals(['users.0.name' => 'Taylor Otwell'], $data); return Rule::forEach(function ($value, $attribute, $data) { $this->assertNull($value); - $this->assertEquals('users.0.name', $attribute); + $this->assertSame('users.0.name', $attribute); $this->assertEquals(['users.0.name' => 'Taylor Otwell'], $data); return Rule::forEach(function ($value, $attribute, $data) { $this->assertNull($value); - $this->assertEquals('users.0.name', $attribute); + $this->assertSame('users.0.name', $attribute); $this->assertEquals(['users.0.name' => 'Taylor Otwell'], $data); return [Rule::requiredIf(true)];
true
Other
laravel
framework
ed8d75bfa193415986495016e89aac5f9ef0d96b.json
Clarify delay time (#41167)
src/Illuminate/Bus/Queueable.php
@@ -127,7 +127,7 @@ public function allOnQueue($queue) } /** - * Set the desired delay for the job. + * Set the desired delay in seconds for the job. * * @param \DateTimeInterface|\DateInterval|int|null $delay * @return $this
true
Other
laravel
framework
ed8d75bfa193415986495016e89aac5f9ef0d96b.json
Clarify delay time (#41167)
src/Illuminate/Contracts/Mail/Mailable.php
@@ -23,7 +23,7 @@ public function send($mailer); public function queue(Queue $queue); /** - * Deliver the queued message after the given delay. + * Deliver the queued message after (n) seconds. * * @param \DateTimeInterface|\DateInterval|int $delay * @param \Illuminate\Contracts\Queue\Factory $queue
true
Other
laravel
framework
ed8d75bfa193415986495016e89aac5f9ef0d96b.json
Clarify delay time (#41167)
src/Illuminate/Contracts/Queue/Job.php
@@ -33,9 +33,7 @@ public function payload(); public function fire(); /** - * Release the job back into the queue. - * - * Accepts a delay specified in seconds. + * Release the job back into the queue after (n) seconds. * * @param int $delay * @return void
true
Other
laravel
framework
ed8d75bfa193415986495016e89aac5f9ef0d96b.json
Clarify delay time (#41167)
src/Illuminate/Contracts/Queue/Queue.php
@@ -43,7 +43,7 @@ public function pushOn($queue, $job, $data = ''); public function pushRaw($payload, $queue = null, array $options = []); /** - * Push a new job onto the queue after a delay. + * Push a new job onto the queue after (n) seconds. * * @param \DateTimeInterface|\DateInterval|int $delay * @param string|object $job @@ -54,7 +54,7 @@ public function pushRaw($payload, $queue = null, array $options = []); public function later($delay, $job, $data = '', $queue = null); /** - * Push a new job onto the queue after a delay. + * Push a new job onto a specific queue after (n) seconds. * * @param string $queue * @param \DateTimeInterface|\DateInterval|int $delay
true
Other
laravel
framework
ed8d75bfa193415986495016e89aac5f9ef0d96b.json
Clarify delay time (#41167)
src/Illuminate/Events/QueuedClosure.php
@@ -80,7 +80,7 @@ public function onQueue($queue) } /** - * Set the desired delay for the job. + * Set the desired delay in seconds for the job. * * @param \DateTimeInterface|\DateInterval|int|null $delay * @return $this
true
Other
laravel
framework
ed8d75bfa193415986495016e89aac5f9ef0d96b.json
Clarify delay time (#41167)
src/Illuminate/Foundation/Bus/PendingChain.php
@@ -91,7 +91,7 @@ public function onQueue($queue) } /** - * Set the desired delay for the chain. + * Set the desired delay in seconds for the chain. * * @param \DateTimeInterface|\DateInterval|int|null $delay * @return $this
true
Other
laravel
framework
ed8d75bfa193415986495016e89aac5f9ef0d96b.json
Clarify delay time (#41167)
src/Illuminate/Foundation/Bus/PendingDispatch.php
@@ -88,7 +88,7 @@ public function allOnQueue($queue) } /** - * Set the desired delay for the job. + * Set the desired delay in seconds for the job. * * @param \DateTimeInterface|\DateInterval|int|null $delay * @return $this
true
Other
laravel
framework
ed8d75bfa193415986495016e89aac5f9ef0d96b.json
Clarify delay time (#41167)
src/Illuminate/Mail/Mailable.php
@@ -233,7 +233,7 @@ public function queue(Queue $queue) } /** - * Deliver the queued message after the given delay. + * Deliver the queued message after (n) seconds. * * @param \DateTimeInterface|\DateInterval|int $delay * @param \Illuminate\Contracts\Queue\Factory $queue
true
Other
laravel
framework
ed8d75bfa193415986495016e89aac5f9ef0d96b.json
Clarify delay time (#41167)
src/Illuminate/Mail/PendingMail.php
@@ -136,7 +136,7 @@ public function queue(MailableContract $mailable) } /** - * Deliver the queued message after the given delay. + * Deliver the queued message after (n) seconds. * * @param \DateTimeInterface|\DateInterval|int $delay * @param \Illuminate\Contracts\Mail\Mailable $mailable
true
Other
laravel
framework
ed8d75bfa193415986495016e89aac5f9ef0d96b.json
Clarify delay time (#41167)
src/Illuminate/Queue/BeanstalkdQueue.php
@@ -110,7 +110,7 @@ public function pushRaw($payload, $queue = null, array $options = []) } /** - * Push a new job onto the queue after a delay. + * Push a new job onto the queue after (n) seconds. * * @param \DateTimeInterface|\DateInterval|int $delay * @param string $job
true
Other
laravel
framework
ed8d75bfa193415986495016e89aac5f9ef0d96b.json
Clarify delay time (#41167)
src/Illuminate/Queue/Capsule/Manager.php
@@ -114,7 +114,7 @@ public static function bulk($jobs, $data = '', $queue = null, $connection = null } /** - * Push a new job onto the queue after a delay. + * Push a new job onto the queue after (n) seconds. * * @param \DateTimeInterface|\DateInterval|int $delay * @param string $job
true
Other
laravel
framework
ed8d75bfa193415986495016e89aac5f9ef0d96b.json
Clarify delay time (#41167)
src/Illuminate/Queue/DatabaseQueue.php
@@ -112,7 +112,7 @@ public function pushRaw($payload, $queue = null, array $options = []) } /** - * Push a new job onto the queue after a delay. + * Push a new job onto the queue after (n) seconds. * * @param \DateTimeInterface|\DateInterval|int $delay * @param string $job @@ -155,7 +155,7 @@ function ($job) use ($queue, $data, $availableAt) { } /** - * Release a reserved job back onto the queue. + * Release a reserved job back onto the queue after (n) seconds. * * @param string $queue * @param \Illuminate\Queue\Jobs\DatabaseJobRecord $job @@ -168,7 +168,7 @@ public function release($queue, $job, $delay) } /** - * Push a raw payload to the database with a given delay. + * Push a raw payload to the database with a given delay of (n) seconds. * * @param string|null $queue * @param string $payload
true
Other
laravel
framework
ed8d75bfa193415986495016e89aac5f9ef0d96b.json
Clarify delay time (#41167)
src/Illuminate/Queue/InteractsWithQueue.php
@@ -49,7 +49,7 @@ public function fail($exception = null) } /** - * Release the job back into the queue. + * Release the job back into the queue after (n) seconds. * * @param int $delay * @return void
true
Other
laravel
framework
ed8d75bfa193415986495016e89aac5f9ef0d96b.json
Clarify delay time (#41167)
src/Illuminate/Queue/Jobs/BeanstalkdJob.php
@@ -43,7 +43,7 @@ public function __construct(Container $container, Pheanstalk $pheanstalk, Pheans } /** - * Release the job back into the queue. + * Release the job back into the queue after (n) seconds. * * @param int $delay * @return void
true
Other
laravel
framework
ed8d75bfa193415986495016e89aac5f9ef0d96b.json
Clarify delay time (#41167)
src/Illuminate/Queue/Jobs/DatabaseJob.php
@@ -42,7 +42,7 @@ public function __construct(Container $container, DatabaseQueue $database, $job, } /** - * Release the job back into the queue. + * Release the job back into the queue after (n) seconds. * * @param int $delay * @return void
true
Other
laravel
framework
ed8d75bfa193415986495016e89aac5f9ef0d96b.json
Clarify delay time (#41167)
src/Illuminate/Queue/Jobs/Job.php
@@ -119,7 +119,7 @@ public function isDeleted() } /** - * Release the job back into the queue. + * Release the job back into the queue after (n) seconds. * * @param int $delay * @return void
true
Other
laravel
framework
ed8d75bfa193415986495016e89aac5f9ef0d96b.json
Clarify delay time (#41167)
src/Illuminate/Queue/Jobs/RedisJob.php
@@ -85,7 +85,7 @@ public function delete() } /** - * Release the job back into the queue. + * Release the job back into the queue after (n) seconds. * * @param int $delay * @return void
true