<?php
|
|
|
|
namespace Tests\Feature\Collaborators\Auth\Passwords;
|
|
|
|
use App\Collaborator;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Livewire\Livewire;
|
|
use Tests\TestCase;
|
|
|
|
class EmailTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
/** @test */
|
|
public function can_view_password_request_page()
|
|
{
|
|
$this->get(route('collaborators.password.request'))
|
|
->assertSuccessful()
|
|
->assertSeeLivewire('collaborators.auth.passwords.email');
|
|
}
|
|
|
|
/** @test */
|
|
public function a_collaborator_must_enter_an_email_address()
|
|
{
|
|
Livewire::test('collaborators.auth.passwords.email')
|
|
->call('sendResetPasswordLink')
|
|
->assertHasErrors(['email' => 'required']);
|
|
}
|
|
|
|
/** @test */
|
|
public function a_collaborator_must_enter_a_valid_email_address()
|
|
{
|
|
Livewire::test('collaborators.auth.passwords.email')
|
|
->set('email', 'email')
|
|
->call('sendResetPasswordLink')
|
|
->assertHasErrors(['email' => 'email']);
|
|
}
|
|
|
|
/** @test */
|
|
public function a_collaborator_who_enters_a_valid_email_address_will_get_sent_an_email()
|
|
{
|
|
$collaborator = factory(Collaborator::class)->create();
|
|
|
|
Livewire::test('collaborators.auth.passwords.email')
|
|
->set('email', $collaborator->email)
|
|
->call('sendResetPasswordLink')
|
|
->assertNotSet('emailSentMessage', false);
|
|
|
|
$this->assertDatabaseHas('collaborator_password_resets', [
|
|
'email' => $collaborator->email,
|
|
]);
|
|
}
|
|
}
|