c.m.saravana@gmail.com's avatar

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 ....

0 likes
0 replies

Please or to participate in this conversation.