Let's get started quickly I found new things in Laravel 9.13 Released I wanted to share with you.
- Add value() Collection Method https://github.com/laravel/framework/pull/42257
method to the Collection class, which gets a single key's value from the first matching item in the collection
$c = new $collection([
['id' => 1, 'name' => 'Hello'],
['id' => 2, 'name' => 'World']
]);
$this->assertEquals('Hello', $c->value('name'));
$this->assertEquals('World', $c->where('id', 2)->value('name'));
- Array map() Method
$data = ['first' => 'taylor', 'last' => 'otwell'];
$mapped = Arr::map($data, function ($value, $key) {
return $key.'-'.strrev($value);
});
- Test Response collect() Method
collect() method to the TestResponse class to get the JSON-decoded body of the response as a collection
$response->collect();
/*
Given the following array of data for a JSON response
[
'foo' => ['foobar_foo' => 'foo', 'foobar_bar' => 'bar'],
...
];
*/
$response->collect('foo')
// Returns a collection instance with:
// ['foobar_foo' => 'foo', 'foobar_bar' => 'bar']
- Add new TestResponse helper: assertJsonMissingPath https://github.com/laravel/framework/pull/42361
$this->getJson('/users/1')
->assertOk()
->assertJsonMissingPath('email'); // Never return the user email
$this->getJson('/articles')
->assertOk()
->assertJsonMissingPath('data.0.internalTags');
- Add AssertCount() in NotificationFake https://github.com/laravel/framework/pull/42366
Notification::assertCount(4) // any number
I hope you enjoyed with me and to learn more about this release visit the sources and search more. I adore you who search for everything new.
Source :- https://laravel-news.com/laravel-9-13-0
Source :- https://www.youtube.com/watch?v=8BVnn0qezM8
Top comments (0)