How do I set laravel test to go to site name instead of localhost

0 votes

I am trying to write some tests for an application. I have the server set up on MAMP going to dev.myappnamehere.com.

When I run a test (based off of Laracasts Integrated) it fails because it is looking for the route

 http://localhost/p/profile

But what it needs to go to is

 http://dev.myappnamehere/p/profile

How can I change that so it does not default to looking for the localhost and instead goes to the correct path?

I attempted to change this in the test but got nowhere and I was unable to located an answer through googling.

 <?php

 use Laracasts\Integrated\Extensions\Laravel as IntegrationTest;
 use Laracests\TestDummy\Factory as TestDummy;

 class ExampleTest extends TestCase {

/**
 * A basic functional test example.
 *
 * @return void
 */
public function testBasicExample()
{
    $this->visit('/')
    ->see('Login')
        ->type('example@example.com', 'email')
        ->type('password', 'password')
        ->press('Login')
        ->seePageIs('/p/profile');
  }

}
Nov 2, 2020 in Laravel by kartik
• 37,510 points
2,993 views

1 answer to this question.

0 votes

Hii,

For Laravel 5, In the tests directory there should be a file called TestCase.php. In that file is a property $baseUrl. Update the value to your desired url. For example change

protected $baseUrl = 'http://localhost';

to

protected $baseUrl = 'http://dev.myappnamehere';

Hope it works!!

answered Nov 2, 2020 by Niroj
• 82,880 points

Related Questions In Laravel

0 votes
1 answer

How do I write to the console from a Laravel Controller?

Hello @kartik, This can be done with the ...READ MORE

answered Aug 11, 2020 in Laravel by Niroj
• 82,880 points
6,886 views
0 votes
1 answer

How do I write to the console from a Laravel Controller?

Hello @kartik, This can be done with the ...READ MORE

answered Oct 29, 2020 in Laravel by Niroj
• 82,880 points
532 views
0 votes
1 answer

How to change Laravel official name to any customize name?

Hey, You just need to go Laravel folder through ...READ MORE

answered Mar 17, 2020 in Laravel by Niroj
• 82,880 points
2,605 views
+2 votes
2 answers

How to add a new column to existing table of laravel in a migration?

You need do little modification in your ...READ MORE

answered Dec 10, 2020 in Laravel by anonymous
• 82,880 points
119,533 views
0 votes
1 answer

How can we Create Multiple Where Clause Query Using Laravel Eloquent?

Hii, You can use Conditions using Array: $users = User::where([ ...READ MORE

answered Mar 30, 2020 in Laravel by Niroj
• 82,880 points
16,181 views
0 votes
1 answer

How to send email using php?

Hello @kartik 1.) Download PHPMailer, open the zip file ...READ MORE

answered Apr 1, 2020 in PHP by Niroj
• 82,880 points
1,021 views
0 votes
1 answer

Where to register Facades & Service Providers in Lumen?

Hello, To register a facade with an alias, ...READ MORE

answered Apr 6, 2020 in Laravel by Niroj
• 82,880 points
4,078 views
0 votes
1 answer

How can I update NodeJS and NPM to the next versions?

Hello @kartik, First check your NPM version npm -v 1).Update ...READ MORE

answered May 5, 2020 in Java-Script by Niroj
• 82,880 points
760 views
0 votes
1 answer

How Can I Set the Default Value of a Timestamp Column to the Current Timestamp with Laravel Migrations?

Hello, To create both of the created_at and updated_at columns: $t->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP')); $t->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP on update ...READ MORE

answered Apr 2, 2020 in Laravel by Niroj
• 82,880 points
11,459 views
0 votes
1 answer

How do I set up phpMyAdmin on a Laravel Homestead box?

Hello, Step 1: Go to the phpMyAdmin website, download the latest ...READ MORE

answered Mar 31, 2020 in Laravel by Niroj
• 82,880 points
6,806 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP