Mar 2, 2017
0
Level 1
Route get path test case
I have created a route status function in model and I want to write a test case for that
class Path extends Model { public static function getRouteStatus(){ if (Route::getCurrentRoute()->getPath() == '/') { return true; } return false; } }
In test case I wrote a test case like this
class PathTest extends TestCase { public function testGetRouteStatus() { $test = Test:: getRouteStatus(); $this->assertFalse($test); } }
When i try to execute the test case in web page, I am getting the following error.
Fatal error: Call to a member function getPath() on null in /Users/www/name/project/tests/PathTest.php on line ....
Please or to participate in this conversation.