Get your next remote job on LaraJobs.
1 contributor Edit on GitHub Laravel

6 pull requests merged in Laravel during week 34 of 2023

Table of contents:

6 pull requests merged in Laravel during week 34 of 2023

Introduction

Buckle up, esteemed colleagues! Some of this week’s merged pull requests in Laravel give us a mix of improved testing capabilities, seamless handling of job lifecycle hooks, updates for query builders and relations, and additional support for failed job providers!

What was merged in Laravel

A more reliable way to test jobs with BusFake and QueueFake

In the first highlight of the week, Luke Kuzmish brings us a wonderful addition to enhance our testing capabilities. The serializeAndRestoreJobs() method simulates the queuing process and detects potential serialization errors during tests rather than waiting for unpleasant surprises in production. This baby makes test suite failures easier to anticipate and debug! Amazing, right? Kudos to Luke!

Learn more from pull request #1483009836.

public function testCanDispatchJobImproved()
{
Queue::fake()->serializeAndRestore();
 
MyJob::dispatch(fn() => true); // ❌ Exception Serialization of 'Closure' is not allowed. 🥳
}

createOrFirst() now plays nice with transactions

Next, we see an astute fix by Tony Messias on createOrFirst methods in transactions. Using the new withSavepointIfNeeded(fn) method, Tony ensures that the create or attach parts get wrapped within a save point transaction, alleviating issues that might occur without it. A big thumbs-up to Tony!

Catch all the sparkles in pull request #1485758586.

Countable failed job providers

Tim MacDonald swoops in with a solution for more efficient handling of failed jobs. By making the 1st party drivers Countable without introducing a new method on the interface, Tim saves us from retrieve all records into memory and perform an in-memory count. A life-saver for applications with a large volume of failed jobs! Hats off to Tim!

Check out all details in pull request #1489028327.

Job UUID in the JobQueued event

Tim is back in action with an addition that makes tracking a job from being queued to all its lifecycle hooks easier. By providing access to the job’s UUID, which doesn’t change when a job fails and is retried, we get a robust solution for handling job lifecycle hooks. Top-notch work, Tim!

Get more insights from pull request #1489134277.

Artisan becomes more flexible

Nuno Maduro spices things up with his work on slimming Laravel’s 11 skeleton. He allows for chaining a schedule methods directly on the Artisan::command call, which makes the syntax more concise and easier to read. Keep it up, Nuno!

Flex into pull request #1484641172.

A new and more relaxed JSON assertion

In his PR, Günther Debrauwer brilliantly circumvents a common issue when testing API calls by introducing the new method assertJsonPathCanonicalizing. Once more, testing within Laravel becomes a smoother process thanks to Günther’s contribution!

Deep dive into pull request #1480973461.

$users = User::factory()->count(2)->create();
 
$this->get('/api/users')->assertJsonPathCanonicalizing('data.*.id', $users->pluck('id')->all());

Conclusion

That’s all for this week, folks! I hope you found these updates enlightening.

Are you ready to dive into the next week’s Laravel adventures? I’ll bring you more stories of code bravado and technical brilliance. Remember to share these updates with your teammates and other developers who work with Laravel. Happy coding!

Benjamin Crozat

Written by Benjamin Crozat

Indie hacker, blogger, and AI enthusiast building things with the TALL stack. 🔥

Follow me on:

Recommended articles

Laravel 10 is out! Here are every new features and changes. Laravel 10 is out! Here are every new features and changes.

Laravel 10 has been released on February 14, 2023. Let's dive into every relevant new features and changes.

Modified on Nov 2, 2023

Laravel 11: release date and new features Laravel 11: release date and new features

Laravel 11 will be released on February 6th, 2024. Its development is still ongoing. Let's dive into every relevant new feature we know about already.

Modified on Sep 17, 2023

20+ Laravel best practices, tips and tricks to use in 2023 20+ Laravel best practices, tips and tricks to use in 2023

Learning a framework can be overwhelming, but time and execution will make you a master. Here are some best practices to help you toward your goal.

Modified on Oct 17, 2023

A complete history of Laravel's versions (2011-2023) A complete history of Laravel's versions (2011-2023)

What's the current version of Laravel? Is there any LTS release you can rely on? And what about the history of the framework? Let's find out!

Modified on Oct 15, 2023

Gold sponsors New

  • Wire Elements
    Beautiful handcrafted Livewire components.
    Check site
Your business here

Partners

If you buy from one of my partners below, I will be compensated at no cost to you. These are services I use or used, and 100% stand behind.

  • Scalable and reliable VPS hosting.
    Bonus: $200 of free credits
    Check site
  • The Google Analytics alternative without compromise.
    Free trial: 30 days
    Bonus: $10 off your first invoice
    Check site
  • Flare
    Track PHP and JavaScript errors in one place.
    Free trial: 10 days
    Check site
  • Keep track of your Google rankings.
    Free trial: 7 days
    Promo code: WELCOME30
    Check site
- / -