Skip to content

Commit

Permalink
Merge branch '11.x' into feat/middleware-priority-configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
ollieread committed Oct 30, 2024
2 parents e6711ba + 6bed63f commit 12686fc
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 2 deletions.
21 changes: 20 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
# Release Notes for 11.x

## [Unreleased](https://github.com/laravel/framework/compare/v11.29.0...11.x)
## [Unreleased](https://github.com/laravel/framework/compare/v11.30.0...11.x)

## [v11.30.0](https://github.com/laravel/framework/compare/v11.29.0...v11.30.0) - 2024-10-30

* Add `$bind` parameter to `Blade::directive` by [@hossein-zare](https://github.com/hossein-zare) in https://github.com/laravel/framework/pull/53279
* [11.x] Fix `trans_choice()` when translation replacement include `|` separator by [@crynobone](https://github.com/crynobone) in https://github.com/laravel/framework/pull/53331
* [11.x] Allow the authorize method to accept Backed Enums directly by [@johanvanhelden](https://github.com/johanvanhelden) in https://github.com/laravel/framework/pull/53330
* [11.x] use `exists()` instead of `count()` by [@browner12](https://github.com/browner12) in https://github.com/laravel/framework/pull/53328
* [11.x] Docblock Improvements by [@mtlukaszczyk](https://github.com/mtlukaszczyk) in https://github.com/laravel/framework/pull/53325
* Allow for custom Postgres operators to be added by [@boris-glumpler](https://github.com/boris-glumpler) in https://github.com/laravel/framework/pull/53324
* [11.x] Support Optional Dimensions for `vector` Column Type by [@akr4m](https://github.com/akr4m) in https://github.com/laravel/framework/pull/53316
* [11.x] Test Improvements by [@saMahmoudzadeh](https://github.com/saMahmoudzadeh) in https://github.com/laravel/framework/pull/53306
* [11.x] Added `dropColumnsIfExists`, `dropColumnIfExists` and `dropForeignIfExists` by [@eusonlito](https://github.com/eusonlito) in https://github.com/laravel/framework/pull/53305
* [11.x] Provide an error message for PostTooLargeException by [@patrickomeara](https://github.com/patrickomeara) in https://github.com/laravel/framework/pull/53301
* [11.x] Fix integrity constraint violation on failed_jobs_uuid_unique by [@bytestream](https://github.com/bytestream) in https://github.com/laravel/framework/pull/53264
* Revert "[11.x] Added `dropColumnsIfExists`, `dropColumnIfExists` and `dropForeignIfExists`" by [@taylorotwell](https://github.com/taylorotwell) in https://github.com/laravel/framework/pull/53338
* [11.x] Introduce `HasUniqueStringIds` by [@cosmastech](https://github.com/cosmastech) in https://github.com/laravel/framework/pull/53280
* [11.x] Refactor: check for contextual attribute before getting parameter class name by [@korkoshko](https://github.com/korkoshko) in https://github.com/laravel/framework/pull/53339
* [11.x] Pick up existing views and markdowns when creating mails by [@kevinb1989](https://github.com/kevinb1989) in https://github.com/laravel/framework/pull/53308
* [11.x] Add withoutDefer and withDefer testing helpers by [@timacdonald](https://github.com/timacdonald) in https://github.com/laravel/framework/pull/53340

## [v11.29.0](https://github.com/laravel/framework/compare/v11.28.1...v11.29.0) - 2024-10-22

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Application extends Container implements ApplicationContract, CachesConfig
*
* @var string
*/
const VERSION = '11.29.0';
const VERSION = '11.30.0';

/**
* The base path for the Laravel installation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Closure;
use Illuminate\Foundation\Mix;
use Illuminate\Foundation\Vite;
use Illuminate\Support\Defer\DeferredCallbackCollection;
use Illuminate\Support\Facades\Facade;
use Illuminate\Support\HtmlString;
use Mockery;
Expand All @@ -25,6 +26,13 @@ trait InteractsWithContainer
*/
protected $originalMix;

/**
* The original deferred callbacks collection.
*
* @var \Illuminate\Support\Defer\DeferredCallbackCollection|null
*/
protected $originalDeferredCallbacksCollection;

/**
* Register an instance of an object in the container.
*
Expand Down Expand Up @@ -234,4 +242,38 @@ protected function withMix()

return $this;
}

/**
* Execute deferred functions immediately.
*
* @return $this
*/
protected function withoutDefer()
{
if ($this->originalDeferredCallbacksCollection == null) {
$this->originalDeferredCallbacksCollection = $this->app->make(DeferredCallbackCollection::class);
}

$this->swap(DeferredCallbackCollection::class, new class extends DeferredCallbackCollection
{
public function offsetSet(mixed $offset, mixed $value): void
{
$value();
}
});
}

/**
* Restore deferred functions.
*
* @return $this
*/
protected function withDefer()
{
if ($this->originalDeferredCallbacksCollection) {
$this->app->instance(DeferredCallbackCollection::class, $this->originalDeferredCallbacksCollection);
}

return $this;
}
}
21 changes: 21 additions & 0 deletions tests/Foundation/Testing/Concerns/InteractsWithContainerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Foundation\Mix;
use Illuminate\Foundation\Vite;
use Illuminate\Support\Defer\DeferredCallbackCollection;
use Orchestra\Testbench\TestCase;
use stdClass;

Expand Down Expand Up @@ -73,6 +74,26 @@ public function testWithMixRestoresOriginalHandlerAndReturnsInstance()
$this->assertSame($this, $instance);
}

public function testWithoutDefer()
{
$called = [];
defer(function () use (&$called) {
$called[] = 1;
});
$this->assertSame([], $called);

$this->withoutDefer();
defer(function () use (&$called) {
$called[] = 2;
});
$this->assertSame([2], $called);

$this->withDefer();
$this->assertSame([2], $called);
$this->app[DeferredCallbackCollection::class]->invoke();
$this->assertSame([2, 1], $called);
}

public function testForgetMock()
{
$this->mock(InstanceStub::class)
Expand Down

0 comments on commit 12686fc

Please sign in to comment.