I'm trying to have multiple domains in my Laravel 5.1 app
Route::group(['domain' => 'api.example.local'], function() {
Route::resource('users', 'ResultController');
});
Route::group(['domain' => 'www.example.local'], function() {
Route::resource('home', 'HomeController');
});
When i doing the unit test for the api.example.local
public function testApiCall() {
$this->get('v1/users')->seeJson(['data' => 'users']);
}
However, this approach has failed and it's returning 404 request. Therefore, i changed my test url to something like this
public function testApiCall() {
$this->get('http://ift.tt/1jRx9f6')->seeJson(['data' => 'users']);
}
Finally, it's green for the unit test.
I'm wondering if this is the correct way to do it? In additional, I will have different environment, for example http://ift.tt/1MRLpjP. Is that means I need to change the change the url to http://ift.tt/1MRLpjP when I'm doing unit test for stage?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire