Skip to content

Commit

Permalink
- Contact form tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rappasoft committed Jun 27, 2017
1 parent 9e3e6f0 commit 3c97e40
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/Frontend/Forms/LoggedOutFormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
use Illuminate\Support\Facades\Notification;
use App\Notifications\Frontend\Auth\UserNeedsConfirmation;
use App\Notifications\Frontend\Auth\UserNeedsPasswordReset;
use App\Mail\Frontend\Contact\SendContact;
use Illuminate\Support\Facades\Mail;

/**
* Class LoggedOutFormTest.
Expand Down Expand Up @@ -338,4 +340,34 @@ public function testInvalidLoginCredentials()
->seePageIs('/login')
->see('These credentials do not match our records.');
}

/**
* Test the contact forms required fields
*/
public function testContactFormRequiredFields() {
$this->visit('/contact')
->press(trans('labels.frontend.contact.button'))
->seePageIs('/contact')
->see('The name field is required.')
->see('The email field is required.')
->see('The message field is required.');
}

/**
* Test the contact form sends the mail
*/
public function testContactForm() {
Mail::fake();

$this->visit('/contact')
->type('Admin Istrator', 'name')
->type('admin@admin.com', 'email')
->type('1112223333', 'phone')
->type('Hello There', 'message')
->press(trans('labels.frontend.contact.button'))
->seePageIs('/contact')
->see(trans('alerts.frontend.contact.sent'));

Mail::assertSent(SendContact::class);
}
}

0 comments on commit 3c97e40

Please sign in to comment.