joshgaber / NovaUnit

Unit testing suite for Laravel Nova, built to extend PHPUnit
https://joshgaber.github.io/NovaUnit
MIT License
67 stars 23 forks source link

MockLenRequest failed on Nova 4.26.0 #61

Open kichetof opened 1 year ago

kichetof commented 1 year ago

Hello,

Nova 4.26.0 introduce a new parameter on withOrdering method in LensRequest class. As MockLensRequest extend it, withOrdering must have it.

Error output:

  In MockLensRequest.php line 27:                                                                                                                                                                                                                             

    Declaration of JoshGaber\NovaUnit\Lenses\MockLensRequest::withOrdering($que                                                                                                                                                                               
    ry) must be compatible with Laravel\Nova\Http\Requests\LensRequest::withOrd                                                                                                                                                                               
    ering($query, $defaultCallback = null)

Nova 4.26.0 withOrdering definition: public function withOrdering($query, $defaultCallback = null)

Easy fix in \JoshGaber\NovaUnit\Lenses\MockLensRequest

    // add second parameter $defaultCallback = null
    public function withOrdering($query, $defaultCallback = null)
    {
        $this->withOrdering = true;

        return $query;
    }

Hope you'll fix it Thanks!

kichetof commented 6 months ago

issue could be closed after PR #64 will be merged!