PHP Classes

File: tests/Feature/Auth/AuthenticationTest.php

Recommend this page to a friend!
  Classes of Maniruzzaman Akash   Laravel Stripe Checkout   tests/Feature/Auth/AuthenticationTest.php   Download  
File: tests/Feature/Auth/AuthenticationTest.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Laravel Stripe Checkout
E-commerce checkout that uses Stripe to pay orders
Author: By
Last change:
Date: 1 year ago
Size: 771 bytes
 

Contents

Class file image Download
<?php

use App\Models\User;
use
App\Providers\RouteServiceProvider;

test('login screen can be rendered', function () {
   
$response = $this->get('/login');

   
$response->assertStatus(200);
});

test('users can authenticate using the login screen', function () {
   
$user = User::factory()->create();

   
$response = $this->post('/login', [
       
'email' => $user->email,
       
'password' => 'password',
    ]);

   
$this->assertAuthenticated();
   
$response->assertRedirect(RouteServiceProvider::HOME);
});

test('users can not authenticate with invalid password', function () {
   
$user = User::factory()->create();

   
$this->post('/login', [
       
'email' => $user->email,
       
'password' => 'wrong-password',
    ]);

   
$this->assertGuest();
});