Open bigweld86 opened 6 years ago
Which lesson/commit are you working with? I tried going through the github repo to figure out how you could be triggering that error on line 68 of ConcertTest.php, and gave up after several dozen times seeing things off by 10+ lines.
@drbyte I'm in the lesson named Testing Query Scopes
Everything up to this lesson was fine. This is the part that's failing:
$publishedConcerts = Concert::published()->get();
Here's the scope in the Model:
public function scopePublished($query)
{
return $query->whereNotNull('published_at');
}
And here's the call in the controller:
$concert = Concert::published()->findOrFail($id);
I've checked multiple times and the code is exactly the one from the lecture.
Thanks.
I think yours is a PHP 7.2 limitation, which requires a Laravel version that's been updated for compatibility.
https://github.com/laravel/framework/blame/5.3/src/Illuminate/Database/Eloquent/Builder.php#L1231 https://github.com/laravel/framework/blame/5.4/src/Illuminate/Database/Eloquent/Builder.php#L936 https://github.com/laravel/framework/pull/20258/files
I realize that bumping up to Laravel 5.5 is a bigger leap until you get through several more lessons to the one where Adam does a big refactor for that.
Consuming the rest of this course will be easier if you can downgrade to PHP 7.1.
@drbyte I just downgrade to PHP 7.1 and it worked fine! Thanks a lot (y)!!!
Just in case anyone else is following along using 5.3 and runs into this issue, the easiest way to get around it is to use the latest unreleased version of Laravel 5.3.
Run this in your terminal:
composer require laravel/framework:5.3.x-dev
...or change your laravel/framework
dependency in your composer.json file to 5.3.x-dev
.
@adamwathan this note for php7.2 users should really be included in the beginning of the course, where you include the composer command to install Laravel 5.3... :)
Just ran into the same issue, luckily I just installed Valet a couple days ago so it was only a valet use php7.1
Thanks for this course btw, it rocks, super happy and already learned a bunch of cool things.
Hi. I started my tests as recomended in the videos, using Laravel 5.3. When working on the test concerts_with_a_published_at_date_are_published I'm getting an issue, according to what I have found online, it is related to PHP7.2.
Here's the issue:
Is there a way to solve this without modifying the PHP version? I tried updating to Laravel 5.4 and followed the steps related to using BrowserKitTest but that didn't work either.
Thanks, Sebastian