Looks like people are not using phpunit much :|, am I using the right tool for testing? Anyone please, there is something strange going on with the $base_url, APP_URL and the visit function parameters that I am not able to figure out.
Apr 11, 2016
7
Level 9
PhpUnit and access to External URL
On my windows PC I have an instance of laravel 5.2 running and I have one named route in it called testroute.
I wrote a phpunit test cases
public function testBasicExample1() {
$this->visit('testroute')->see('Something'); //Passes
}
public function testBasicExample2() {
$this->visit('http://www.google.com')->see("I'm Feeling"); //Fail
}
in TestCase.php
$baseUrl = 'http://localhost:8000';
and in .env APP_URL=http://localhost:8000
How do I access external URLs in laravel phpunit testcases?
I need this as I have a separate non-laravel api server and I need to access those and test responses in my laravel project.
Thanks
Please or to participate in this conversation.