{"id":9427,"date":"2021-01-14T11:23:32","date_gmt":"2021-01-14T16:23:32","guid":{"rendered":"http:\/\/local.brightwhiz\/?p=9427"},"modified":"2021-01-14T11:23:32","modified_gmt":"2021-01-14T16:23:32","slug":"laravel-8-22-release-with-new-event-fake-assertion","status":"publish","type":"post","link":"http:\/\/local.brightwhiz\/laravel-8-22-release-with-new-event-fake-assertion\/","title":{"rendered":"Laravel 8.22 Release With new Event Fake Assertion Announced"},"content":{"rendered":"\n

Laravel 8.22 release with a new event fake assertion, a collection method to reduce associative arrays to a single value has been announced.<\/p>\n\n\n\n

This new release also comes with several fixes and improvements.<\/p>\n\n\n\n

Laravel 8.22 comes with a new assertion assertNothingDispatched()<\/strong> to Event::fake()<\/strong> mock. Currently, all the assertion for Events require a specific event to be provided, this will catch “any” event. See example:<\/p>\n\n\n

[php]
\nEvent::fake();<\/p>\n

foo(false); \/\/ Function that should NOT dispatch any event<\/p>\n

Event::assertNothingDispatched();
\n[\/php]<\/p>\n\n\n\n

<\/p>\n\n\n\n

Add reduce with keys to collections and lazy collections features adds the method reduceWithKeys <\/strong><\/em>to Collections and LazyCollections<\/strong><\/em>.<\/p>\n\n\n\n

Similar to map and mapWithKeys<\/strong><\/em>, this augments reduce to pass associative arrays’ keys to its callback. We can’t do that currently because PHP<\/a>‘s array_reduce doesn’t pass array keys to its callback. See example:<\/p>\n\n\n

[php]
\n$data = collect([
\n ‘name’ => ‘Mo Khosh’,
\n ‘username’ => ‘mokhosh’,
\n]);<\/p>\n

return $data->reduceWithKeys(function($carry, $value, $key) {
\n return $carry . $key . ‘: ‘ . $value . PHP_EOL;
\n});
\n[\/php]<\/p>\n\n\n\n

Fixes in this release include a fixed error from missing null check on PHP 8 in Illuminate\\Validation\\Concerns\\ValidatesAttributes::validateJson()<\/strong>. A bug with RetryCommand can happen if retryUntil <\/strong><\/em>doesn’t return a DateTimeInterface object but rather an integer timestamp or null.<\/p>\n\n\n\n

Issues in Illuminate\\Testing\\PendingCommand::expectsTable()<\/strong> have been fixed as is the same with morphTo()<\/strong> attempting to map an empty string morph type to an instance.<\/p>\n\n\n\n

For these and more about Laravel 8.22 release please visit the changelog here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"

Laravel 8.22 release with a new event fake assertion, a collection method to reduce associative arrays to a single value has been announced. This new release also comes with several…<\/p>\n","protected":false},"author":1,"featured_media":9428,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25,13,27,16],"tags":[252,344,350,424,452],"yoast_head":"\nLaravel 8.22 Release With new Event Fake Assertion Announced<\/title>\n<meta name=\"description\" content=\"Laravel 8.22 release with a new event fake assertion, a collection method to reduce associative arrays to a single value has been announced\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/local.brightwhiz\/laravel-8-22-release-with-new-event-fake-assertion\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Laravel 8.22 Release With new Event Fake Assertion Announced\" \/>\n<meta property=\"og:description\" content=\"Laravel 8.22 release with a new event fake assertion, a collection method to reduce associative arrays to a single value has been announced\" \/>\n<meta property=\"og:url\" content=\"http:\/\/local.brightwhiz\/laravel-8-22-release-with-new-event-fake-assertion\/\" \/>\n<meta property=\"og:site_name\" content=\"Brightwhiz.com\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/brightwhiz\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-01-14T16:23:32+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/01\/laravel-8.22-release.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Michael Bright\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@brightwhizmag\" \/>\n<meta name=\"twitter:site\" content=\"@brightwhizmag\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Michael Bright\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\/\/local.brightwhiz\/laravel-8-22-release-with-new-event-fake-assertion\/#article\",\"isPartOf\":{\"@id\":\"http:\/\/local.brightwhiz\/laravel-8-22-release-with-new-event-fake-assertion\/\"},\"author\":{\"name\":\"Michael Bright\",\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/person\/81f0f3126f13834ae2e7f381b3028e32\"},\"headline\":\"Laravel 8.22 Release With new Event Fake Assertion Announced\",\"datePublished\":\"2021-01-14T16:23:32+00:00\",\"dateModified\":\"2021-01-14T16:23:32+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/local.brightwhiz\/laravel-8-22-release-with-new-event-fake-assertion\/\"},\"wordCount\":242,\"publisher\":{\"@id\":\"http:\/\/local.brightwhiz\/#organization\"},\"image\":{\"@id\":\"http:\/\/local.brightwhiz\/laravel-8-22-release-with-new-event-fake-assertion\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/01\/laravel-8.22-release.jpg\",\"keywords\":[\"Frameworks\",\"Laravel\",\"Libraries\",\"Open Source\",\"PHP\"],\"articleSection\":[\"Libraries\",\"News\",\"Programming\",\"Technology\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/local.brightwhiz\/laravel-8-22-release-with-new-event-fake-assertion\/\",\"url\":\"http:\/\/local.brightwhiz\/laravel-8-22-release-with-new-event-fake-assertion\/\",\"name\":\"Laravel 8.22 Release With new Event Fake Assertion Announced\",\"isPartOf\":{\"@id\":\"http:\/\/local.brightwhiz\/#website\"},\"primaryImageOfPage\":{\"@id\":\"http:\/\/local.brightwhiz\/laravel-8-22-release-with-new-event-fake-assertion\/#primaryimage\"},\"image\":{\"@id\":\"http:\/\/local.brightwhiz\/laravel-8-22-release-with-new-event-fake-assertion\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/01\/laravel-8.22-release.jpg\",\"datePublished\":\"2021-01-14T16:23:32+00:00\",\"dateModified\":\"2021-01-14T16:23:32+00:00\",\"description\":\"Laravel 8.22 release with a new event fake assertion, a collection method to reduce associative arrays to a single value has been announced\",\"breadcrumb\":{\"@id\":\"http:\/\/local.brightwhiz\/laravel-8-22-release-with-new-event-fake-assertion\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/local.brightwhiz\/laravel-8-22-release-with-new-event-fake-assertion\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/local.brightwhiz\/laravel-8-22-release-with-new-event-fake-assertion\/#primaryimage\",\"url\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/01\/laravel-8.22-release.jpg\",\"contentUrl\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/01\/laravel-8.22-release.jpg\",\"width\":1200,\"height\":630,\"caption\":\"Laravel 8.22 Release\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/local.brightwhiz\/laravel-8-22-release-with-new-event-fake-assertion\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/local.brightwhiz\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Laravel 8.22 Release With new Event Fake Assertion Announced\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/local.brightwhiz\/#website\",\"url\":\"http:\/\/local.brightwhiz\/\",\"name\":\"Brightwhiz.com\",\"description\":\"Best Tech guides, Tutorials, and News\",\"publisher\":{\"@id\":\"http:\/\/local.brightwhiz\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/local.brightwhiz\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"http:\/\/local.brightwhiz\/#organization\",\"name\":\"Brightwhiz\",\"url\":\"http:\/\/local.brightwhiz\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/logo\/image\/\",\"url\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/11\/brightwhiz-com-logo-orange.png\",\"contentUrl\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/11\/brightwhiz-com-logo-orange.png\",\"width\":706,\"height\":135,\"caption\":\"Brightwhiz\"},\"image\":{\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/brightwhiz\/\",\"https:\/\/x.com\/brightwhizmag\",\"https:\/\/instagram.com\/bright_whiz\/\",\"https:\/\/www.pinterest.com\/sobbayi\/\",\"https:\/\/www.youtube.com\/channel\/UC6sCdP_d_RiTIM7ErFT-PSQ\"]},{\"@type\":\"Person\",\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/person\/81f0f3126f13834ae2e7f381b3028e32\",\"name\":\"Michael Bright\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/1.gravatar.com\/avatar\/da90485875ff0aafa38fdd494abe87d1?s=96&d=mm&r=g\",\"contentUrl\":\"http:\/\/1.gravatar.com\/avatar\/da90485875ff0aafa38fdd494abe87d1?s=96&d=mm&r=g\",\"caption\":\"Michael Bright\"},\"sameAs\":[\"https:\/\/sobbayi.com\"],\"url\":\"http:\/\/local.brightwhiz\/author\/sobbayiadmin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Laravel 8.22 Release With new Event Fake Assertion Announced","description":"Laravel 8.22 release with a new event fake assertion, a collection method to reduce associative arrays to a single value has been announced","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/local.brightwhiz\/laravel-8-22-release-with-new-event-fake-assertion\/","og_locale":"en_US","og_type":"article","og_title":"Laravel 8.22 Release With new Event Fake Assertion Announced","og_description":"Laravel 8.22 release with a new event fake assertion, a collection method to reduce associative arrays to a single value has been announced","og_url":"http:\/\/local.brightwhiz\/laravel-8-22-release-with-new-event-fake-assertion\/","og_site_name":"Brightwhiz.com","article_publisher":"https:\/\/www.facebook.com\/brightwhiz\/","article_published_time":"2021-01-14T16:23:32+00:00","og_image":[{"width":1200,"height":630,"url":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/01\/laravel-8.22-release.jpg","type":"image\/jpeg"}],"author":"Michael Bright","twitter_card":"summary_large_image","twitter_creator":"@brightwhizmag","twitter_site":"@brightwhizmag","twitter_misc":{"Written by":"Michael Bright","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/local.brightwhiz\/laravel-8-22-release-with-new-event-fake-assertion\/#article","isPartOf":{"@id":"http:\/\/local.brightwhiz\/laravel-8-22-release-with-new-event-fake-assertion\/"},"author":{"name":"Michael Bright","@id":"http:\/\/local.brightwhiz\/#\/schema\/person\/81f0f3126f13834ae2e7f381b3028e32"},"headline":"Laravel 8.22 Release With new Event Fake Assertion Announced","datePublished":"2021-01-14T16:23:32+00:00","dateModified":"2021-01-14T16:23:32+00:00","mainEntityOfPage":{"@id":"http:\/\/local.brightwhiz\/laravel-8-22-release-with-new-event-fake-assertion\/"},"wordCount":242,"publisher":{"@id":"http:\/\/local.brightwhiz\/#organization"},"image":{"@id":"http:\/\/local.brightwhiz\/laravel-8-22-release-with-new-event-fake-assertion\/#primaryimage"},"thumbnailUrl":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/01\/laravel-8.22-release.jpg","keywords":["Frameworks","Laravel","Libraries","Open Source","PHP"],"articleSection":["Libraries","News","Programming","Technology"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"http:\/\/local.brightwhiz\/laravel-8-22-release-with-new-event-fake-assertion\/","url":"http:\/\/local.brightwhiz\/laravel-8-22-release-with-new-event-fake-assertion\/","name":"Laravel 8.22 Release With new Event Fake Assertion Announced","isPartOf":{"@id":"http:\/\/local.brightwhiz\/#website"},"primaryImageOfPage":{"@id":"http:\/\/local.brightwhiz\/laravel-8-22-release-with-new-event-fake-assertion\/#primaryimage"},"image":{"@id":"http:\/\/local.brightwhiz\/laravel-8-22-release-with-new-event-fake-assertion\/#primaryimage"},"thumbnailUrl":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/01\/laravel-8.22-release.jpg","datePublished":"2021-01-14T16:23:32+00:00","dateModified":"2021-01-14T16:23:32+00:00","description":"Laravel 8.22 release with a new event fake assertion, a collection method to reduce associative arrays to a single value has been announced","breadcrumb":{"@id":"http:\/\/local.brightwhiz\/laravel-8-22-release-with-new-event-fake-assertion\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/local.brightwhiz\/laravel-8-22-release-with-new-event-fake-assertion\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/local.brightwhiz\/laravel-8-22-release-with-new-event-fake-assertion\/#primaryimage","url":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/01\/laravel-8.22-release.jpg","contentUrl":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/01\/laravel-8.22-release.jpg","width":1200,"height":630,"caption":"Laravel 8.22 Release"},{"@type":"BreadcrumbList","@id":"http:\/\/local.brightwhiz\/laravel-8-22-release-with-new-event-fake-assertion\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/local.brightwhiz\/"},{"@type":"ListItem","position":2,"name":"Laravel 8.22 Release With new Event Fake Assertion Announced"}]},{"@type":"WebSite","@id":"http:\/\/local.brightwhiz\/#website","url":"http:\/\/local.brightwhiz\/","name":"Brightwhiz.com","description":"Best Tech guides, Tutorials, and News","publisher":{"@id":"http:\/\/local.brightwhiz\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/local.brightwhiz\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"http:\/\/local.brightwhiz\/#organization","name":"Brightwhiz","url":"http:\/\/local.brightwhiz\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/local.brightwhiz\/#\/schema\/logo\/image\/","url":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/11\/brightwhiz-com-logo-orange.png","contentUrl":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/11\/brightwhiz-com-logo-orange.png","width":706,"height":135,"caption":"Brightwhiz"},"image":{"@id":"http:\/\/local.brightwhiz\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/brightwhiz\/","https:\/\/x.com\/brightwhizmag","https:\/\/instagram.com\/bright_whiz\/","https:\/\/www.pinterest.com\/sobbayi\/","https:\/\/www.youtube.com\/channel\/UC6sCdP_d_RiTIM7ErFT-PSQ"]},{"@type":"Person","@id":"http:\/\/local.brightwhiz\/#\/schema\/person\/81f0f3126f13834ae2e7f381b3028e32","name":"Michael Bright","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/local.brightwhiz\/#\/schema\/person\/image\/","url":"http:\/\/1.gravatar.com\/avatar\/da90485875ff0aafa38fdd494abe87d1?s=96&d=mm&r=g","contentUrl":"http:\/\/1.gravatar.com\/avatar\/da90485875ff0aafa38fdd494abe87d1?s=96&d=mm&r=g","caption":"Michael Bright"},"sameAs":["https:\/\/sobbayi.com"],"url":"http:\/\/local.brightwhiz\/author\/sobbayiadmin\/"}]}},"_links":{"self":[{"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/posts\/9427"}],"collection":[{"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/comments?post=9427"}],"version-history":[{"count":0,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/posts\/9427\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/media\/9428"}],"wp:attachment":[{"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/media?parent=9427"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/categories?post=9427"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/tags?post=9427"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}